Email or username:

Password:

Forgot your password?
✨jes✨

FYI, when a website erases your text that you just spent an hour writing, you can use this little trick to recover it 99% of the time:

1. find the firefox pid

$ pgrep -l firefox

2. attach gdb to firefox and dump its core

$ sudo gdb <pid>
gcore firefox.dump
<this takes awhile>
quit
<firefox dies>

3. find your lost text in the coredump

$ strings firefox.dump | grep "a unique word/sentence from ur text"

i just did this today to recover a long post i wrote, and figured i'd show others!! :uxn:

183 comments
shards of tebicat

@j3s "just pull the string out of memory, obviously"

LisPi

@tebicat @j3s I think the only reason to dump & crash it is to avoid the memory being reused or otherwise collected.

✨jes✨

@lispi314 @tebicat the other reason is because a demolition derby is more fun than a horse race

✨jes✨

@ellenor2000 if u think this is scary u should see the weird wooden creature i encountered by lake michigan

Rob Carlson

@j3s This is the tech equivalent of "if you lose your wedding ring down the shower drain, you can earn a degree in mechanical engineering with a public infrastructure focus, get a job at the sewage processing plant, strain through the effluent to create a mold to make a new copy of it."

✨jes✨

@vees i see it more like "if you lose some important documents down a drain, dump all of the pipes on the ground & grab your document"

Rob Carlson

@j3s @vees Casual use of gdb implies a master plumber level’s toolbox in arms reach.

Brian Hawthorne

@FandaSin @j3s @vees I never realized they were plumbers. Where’s the butt-crack?

LisPi

@vees @j3s Eh, just an angle grinder (or just a metal saw if you don't feel like getting electrocuted) and some rainboots.

4censord :neocat_flag_pan:

@lispi314 @vees @j3s depending on where in the pipe, a pipe wrench might just do

LisPi

@4censord @vees @j3s Well yes, but then you're getting into the "having proper plumbing tools" thing.

4censord :neocat_flag_pan:

@lispi314 @vees @j3s hmm, I had a pipe wrench like years before having any type of metal compatible saw, but I also just never needed to cut things

✨jes✨

@4censord @lispi314 @vees while you have been arguing about tools, i have been studying the blade

wakame

@j3s @4censord @lispi314 @vees

With enough determination, a wrench can become a saw.

Related: Ah, the good old C-x M-dumpgrep. Why didn't you say so?

xkcd.com/378/

Albert Cardona

@vees @j3s

The instructions are clear enough, and almost complete: to attach gdb, at least in Ubuntu 22.04 it needs the "-p" flag. I just tried them out to find this very text I am typing now.

$ pgrep -l firefox
$ sudo gdb -p <PID>
(gdb) gcore firefox.dump
control+D
$ vi firefox.dump

What took longest is opening the 3GB dump file. At least 'vi' was up for the task. Could have been done more effectively by grep'ing the text.

Julianoë

@vees @j3s ahaha. For people that don't have this time in their hands: never write long form in someonelse untrusty interface. Just write it somewhere and Ctrl+c Ctrl+v 😋

Softwarewolf

@Julianoe @vees @j3s This is exactly what I do. Although usually I only think about it after my input has been erased at least once. :blobfoxnotlikethis:

Ondrej Mikle

@vees This is effect of stupid javascript frameworks. Normal HTML form will not lose the text when you go back, for example.

There are lots of shitty javascript frameworks and sites that do bonkers UX, I have 5+ addons to "unfuck web".

There used to be "edit in external editor" simple addon for this, which saved both locally and into the form, but now because of various reasons you need to actually run a tiny web server *and* have addon just for this, because it needs to execute editor.

bobo mode

@oreolek @j3s

for ages I've wanted to make an extension for exactly this problem, except my plan was to save the attributes and contents of every input on the page so it could be helpful with long complex multi-stage forms with heaps of tiny input elements, too (imo that's the bigger problem needing automation, because users can easily copy from huge text inputs). thanks for the reference!

wizzwizz4

@jonk @oreolek @j3s Let me know if you make that, please! I've been manually copy-pasting to a text file…

Csepp 🌢

@jonk @oreolek @j3s Have you tried Form History Control? I've been using it for a while and it saved my ass a few times.

Graham Spookyland🎃/Polynomial

@j3s for Windows users, you can do the same thing but with x64dbg. attach to the process, use the string search function, then resume all threads and detach.

AnonyMoose 🇨🇦

@gsuberland
@j3s

I think I'll just angrily attempt to recreate what I typed and then be unsatisfied with the result. Thanks for the tip though.

✨jes✨

@An0n why be angry when u can core dump ✨for practical reasons✨

mnl mnl mnl mnl mnl

@j3s @zkat Firefox UX keeps getting better 😅

more seriously that’s a very cool trick, I’m sure I’ll get to use it.

penguin42

@j3s There's something very wrong with the world needing to do that.

✨jes✨

@adamshostack an oversight - if you own the firefox proc you should be able to leave sudo out.

digitalfox

@j3s @adamshostack You might need to adjust process attach permissions for the kernel though, depending on your distribution - "/proc/sys/kernel/yama/ptrace_scope":
wiki.ubuntu.com/SecurityTeam/R

Adam Shostack :donor: :rebelverified:

@digitalfox @j3s Thanks! I had missed that change to how processes within a uid interact.

Jos

@j3s This is amazing, yet terrifying at the same time. I'm definitely using it.

John Turner

@j3s This is incredible. It feels like the web version of “if someone forgets what you told them: stop time, lay out the last 5 minutes of the timeline into a tesseract, destroy the current timeline, find when you told them the thing inside the tesseract and record what you said, then restart a new timeline at the point where you’re about to tell them a thing, at which point you can play them the recording”

David Zaslavsky

@while1malloc0 @j3s Reminds me of youtube.com/watch?v=CXhnPLMIET

Funnily enough just today I watched the episode of Rick and Morty that may have been inspired by that premise

Clifford Adams

@j3s

Easier tip to make sure the website never erases your text (works on almost all browsers!):

1. Type your long text.

2. Type CONTROL-A to select all, then

3. Type almost anything *EXCEPT* CONTROL-C ...

Congratulations! You just erased your text before the website could! Maybe a core dump would help, but maybe not.

For extra fun in step 3 type CONTROL-V.

Hope this helps someone! 🤪

Clifford Adams

@Anafabula
Drat! Those meddling kids and their new undo technology! 😃 (To me Ctrl-Z is the Unix suspend process. Heck, I'm old enough to remember Ctrl-S flow control. 😜 )

Brendan

@j3s this is a pretty great trick. I have always grieved, then started over.

Threadbane

@j3s
Cool. Sounds like something I'd have done 20 years ago. 8^)

efelbar

@j3s though I don't fully understand what this does or the tools used... I can *feel* the cursed vibes radiating off of it >:3

when have you had a website erase text without it being related to a crash/page reload/etc, which I assume this trick does not work on?

✨jes✨

@flbr this should work on a page crash/reload situation as well! firefox has a bunch of memory and your string of words is probably still in that abyss somewhere, waiting to be written over.

but for example when i type a big long answer and hit submit, and the website says my session has timed out, and hitting back only gets me to a "login" page instead of the page w/ my text on it ;..;

efelbar

@j3s ohhhhhh, yeah that's definitely happened to me within the past week, that's super cool!

redmp (EDITED)

@j3s autosave is a rare legitimate use of javascript

✨jes✨

@redmp javascript contempt is bad imo. just bc it’s misused a lot doesn’t mean it is rarely useful. it is useful quite frequently. i never use it because i like the constraint of not having it, but there’s a lot of good shit out there written in js.

redmp (EDITED)

@j3s i agree with everything you said ... and i want autosave in js, though this core-dump trick is nifty :))

Rick O

@j3s thank you for sharing this! I'd rather do this even if it took twice as long as rewriting whatever I lost 😆

DELETED

@j3s i understood almost nothing but saved just in case

Patrick Chizeck

@j3s

I cannot tell if this will recover my writing or delete my hard drive.

⠚⠗⠙⠐⠕⠀⠜⠿⠕

@j3s firefox supposed to hold user inputs whenever user refreshes page, restart their browser.
react ruined it..
I miss good old days

✨jes✨

@jarm good old days had their problems too

Jonathan Trott

@j3s I've trained myself to <cmd>-<a>,<cmd>-<c> before hitting any buttons on a web site - clipboard managers will then have a copy of your text. Sad I've had to train myself to do this though…

Michael Bond

@j3s I've been trying to get into the habit of writing in an external app, and then copying / pasting into the browser.

Daniel Blake

@j3s @lispi314 Or just use the lowtech way of writing in a text editor first & copy-paste your long posting to the flaky website. Any post that’s taking over a minute to type -> text editor.

dana :verifiedtrans:

@j3s nice!
I once did a similar thing, but with my entire hard-drive, after accidentally deleting a project I was working on

#

@j3s That's a little bit of special story. You basically described how a firefox, the browser I know but for the sake of the story it's an animal, ate your notebook and you go in and ram your hand into it's mouth to retrieve it again. An action which is sometimes illustrated in some cartoons and comics.

Lewis Cowles

@j3s okay now someone in security needs to verify this does not apply to password inputs.

Latte macchiato :blobcoffee: :ablobcat_longlong:

@lewiscowles1986@phpc.social @j3s@merveilles.town
Why wouldn't it? You're looking at application memory for working data, that needs to be stored somewhere.

AlexanderMars

@j3s well fuck me… here I’ve been using the command-hulk-smash keystroke(both fists) whenever something like that happensed. All this time, goddamn coredump could’ve saved me like 2 or 7 laptops over the years.

Victor Toulouse

@j3s
Or use an extension like Form History Control?
@ariasuni

Shaunyata

@j3s Or: make a copy of what you write and save it temporarily in a note app until you post the message successfully.

Opsitive

@j3s Your debug fu is strong, but I think, instead of “next time, I’ll use gdb”, I’d go “next time, I’ll use a proper editor first”.

DELETED

@j3s Just in case, I never write long texts in the browser.

Sophie Schmieg

@j3s next time, the website will use madvise(MADV_DONTDUMP), just to be difficult.

David Zaslavsky

@j3s lol I literally just could have used this (but I was lazy and retyped some version of the comment, it wasn't really that long)

Deriamis

@sebsauvage @j3s Or this one: addons.mozilla.org/en-US/firef

There’s a Chrome version, too. I’m certain there are others, depending on your preferences and browser - unless you’re running Safari, in which case you kinda deserve to dig through a core dump to recover that input.

ezaquarii

@j3s I'm saving it to my #orgmode #roam notes.

Yes, this was an advert in disguise. 🤷

fool

@j3s Alternatively,

Ctrl A
Ctrl C
Ctrl End

often.

Nils Goroll 🕊️:varnishcache:

@j3s fosstodon.org/@slink/110955590 🎶 just now strings gcore saved my life 🎶

it was actually `gcore $(pgrep emacs)` and `strings core.*`, but that doesn't match the rhythm of the song.

This was one of the super rare occasions when #emacs would hang with some unsaved code in the undo buffer which I wanted back.
I am so happy to be on a #FOSS Operating Systems which lets me do things (tm).
#c #opensource

Conor Nash

@j3s I love this because someone will read it and go down a rabbit hole, eventually leading to then discovering a whole new level of how computers work 💾

OwlSeeingEye

@j3s this...but for Chromium web browsers...how do? :blob_gnikniht:

towo

@j3s I can also very much recommend the textern extension (github.com/jlebon/textern), which allows you to open any text box with an external editor.

Matt Mascarenhas

@towo @j3s Oh gosh, thanks for the reminder that I used to use this kind of thing! "It's All Text!", mentioned under Related Projects, was the thing in those days.

Mario Sangiorgio

@j3s this reminded me of this paper people.csail.mit.edu/rinard/pa

A program got stuck in an infinite loop?
No big deal: attach a debugger, move the program counter past the end of the loop and carry on

King Calyo Delphi

@j3s I just started precomposing my longer-form writings on notepad++ off to the side then I copypasta in lol

Feuerstein

@j3s Thank you for the nice Tip. I still prefer to write long texts in a text editor or markdown application, then the problem is mitigated. Or I use something like Cryptpad. But maybe someday I (or someone else I know) will need it.

Many Colors, Many Forms, Many Flavors, Maybe More

@j3s@merveilles.town 4. build a habit of composing anything that takes more than a minute or two in a proper editor and copying it over when finished. :)

Many Colors, Many Forms, Many Flavors, Maybe More

@j3s@merveilles.town After gcore, can you detach the debugger to resume Firefox instead of killing it (potentially losing other state)?

Marius Gedminas

@j3s it should be possible to do this without killing Firefox (by using 'detach' instead of 'quit' at the gdb prompt?).

I have a vague memory of recovering lost browser text by doing a sudo grep on /dev/mem once.

(Protip: wrap one letter in the grep regexp with [ ] so the regexp will not match itself, I do that all the time I have do a `ps | grep processname`.)

viq

@j3s and you wonder why wizards are grumpy and reluctant to explain why.

Canadian Curmudgeon

@j3s
"a unique word/sentence from ur text"
I can't spend my time searching my dictionary of cuneiform to find unique words from Sumerian tablets, be they from Ur, NIneveh, or Babylon.

Is there a particular Ur text you have in mind? Perhaps the Lament Over the Destruction of Ur (one of my favourites)? Or the Gilgamesh epic?

And are we supposed to type in the translation or the transliteration? I don't have a cuneiform keyboard.

@j3s
"a unique word/sentence from ur text"
I can't spend my time searching my dictionary of cuneiform to find unique words from Sumerian tablets, be they from Ur, NIneveh, or Babylon.

Is there a particular Ur text you have in mind? Perhaps the Lament Over the Destruction of Ur (one of my favourites)? Or the Gilgamesh epic?

cache mx

@j3s sometimes you can catch it in /dev/kmem or /proc/kcore

silvio

@j3s
step 4:
write in a proper text editor and copy /paste
step 5: (optional)
host your own stuff

;)

Su-Shee

@j3s "find your lost text in core dump" 😂

blhue

@j3s My MO is to continually Select All and Copy when editing any significant amount of copy in a web form.

Been burned too many times over the years it's just muscle memory at this point.

davidak

@j3s now we only need a GUI to make that accessible

Netux

@davidak @j3s ddd exist (is still not accessible) 😜

medium rare bird

@j3s don't forget that sometimes you have to search for your text in utf-16 because javascript

Patrick Mevzek

@j3s Or install "Form History Control" extension...

Laurie Voss

@j3s How much text did you lose for it to be worth figuring out how to retrieve it from a core dump?

Netux

@j3s good tip. For big things I usually just write them in vim them copy paste, but in the off chance I do one in a browser I'll remember this.

pancake :verified:

@j3s or just open proc/pid/mem with r2 and search the text. No need for coredumps or ptrace :3

Netux

@pancake @j3s garbage collection is the enemy, catching and pausing with gdb may be faster than figuring out a good regex

pancake :verified:

@Netux @j3s i prefer sigstop. Much less intrussive than ptrace. And i would never use regex to search in raw memory, it's too slow. Also worth considering searching wide strings if text was cached by javascript

Netux

@pancake @j3s ashamed to admit I didn't even think of sigstop. So rare that I use signals beyond kill and int.
Regex of just matching text, not any magic. Still a regex.

pancake :verified:

@Netux @j3s i use ^Z a lot, the problem with regexes is that they are suposed to run on a limited space in memory. this is, if you use strings is fine, but when searching in memory, the regex expression can expand to read 4GB of memory to find a matching token, and this is not really optimal. Most forensic tools supporting regexes restrict the contents to search in or add limits to the regex engine

Seth Mos

@j3s I just frequently use select all, copy and then paste into a notepad.

Eragon

@j3s This is beautifully over-engineered… I love it !

Noam

@j3s How fast do you have to work before your text is garbage collected/overwritten?

✨jes✨

@noam good question - i’m not sure. i’ve normally done the core dump within a few minutes to try and get ahead of the garbage collection

M. Fioretti

@j3s that's why I NEVER, EVER, EVER write anything longer than 2/3 sentences straight into a browser.

I always write it into a text editor and only when I'm done I paste into "the website", whatever that website is.

Christian Berger DECT 2763

@j3s There's a variant of this for Windows. Just have some program allocate a large amont of RAM (e.g. 8 Megabytes) and you'll find all of your Netscape Navigator, including passwords and other text in your swap-file.

Zyfdnug

@j3s as I tend to have too many tabs open and restarting Firefox thus takes too long for my convenience, I*m using the Form History Control plugin. Less fun, I admit, but saves a bit of time.

Benjamin Marwell

@j3s
Just install the "Lazarus form recovery" plugin (add-on). 🤷🏻‍♂️

Otto

@j3s ... What kind of form on a website would you be writing into for over an hour that you didn't have some ability to save it every once in a while? This is a completely foreign experience to me.

David Jaša

@j3s or you install Form History Control which caches the inputs for you.
@vbabka

Rob Bos

@j3s That would work!

Or you could install Form History Control!

Which will autosave form inputs. It has saved my bacon!

(edit: but seriously that's a really clever idea, it would not have occurred to me to attach gdb to recover that. Bookmarked!)

Aaron

@j3s People should keep this in mind when they agree to send their core dumps in bug reports.

eribosot

@j3s This works best if the unique string is truly unique and long, like “snickerdoodle” for example. The challenge then becomes how to work the word “snickerdoodle” into your document without disrupting the reading experience.

sqrt(-1)

@j3s tip: you can use doas instead of sudo too!

Kaosc

@j3s Yet another reason to use Linux / Unixy OS though there is probably an analogalous but less convenient approach for Windows.

Also, another (preventative) approach is to write the whole thing in Vim first then copy it to the infuriating POS other editor :-)

J.V.B.

@j3s depending on the situation ctrl z also works on a text field

Pete Wright
@j3s you ever break UX so badly that dumping a core in gdb is an attractive workaround?

I honestly can see myself needing this in the future.
Jean-Marie Favreau

@j3s
It should have an extension or a command line program for that.

#wafuposting enjoyer
@j3s ROFL this actually sounds like something that could work, might try that later
Dingus Khan

@j3s might as well make a script to do this

Efi (nap pet) 🦊💤

@j3s wonder if the good old lazarus extension is still mantained

crisl_at

@j3s I just developed a habit of randomly copying the text to clipboard, but do it about 99,5% before hitting submit.

Prof. Dr. Trepurine

@j3s or....

write the Text with a simple Text Editor,

Klaus Stein

@j3s
I try to train myself to use the GhostText addon¹ for any longer text I write in any browser textarea to avoid having to coredump ;-)

__
¹with emacs or any decent editor doing automatic intermediate (recovery) saves

/bin/mzumquadrat

@j3s
Thank you for that awesome piece of information.

Veronica Olsen 🏳️‍🌈🇳🇴🌻

@j3s My low tech approach is to write the text in gedit first 😄

Paranoid Factoid

@j3s I just write in a text editor these days. It's easier.

Go Up