ERESI(1)
ERESI(1) β The ERESI Reverse Engineering Software Interface π
Bestie, this is the ERESI(1) manual page, aka the User commands page, and it's lowkey a whole reverse-engineering universe. Part 1 is right here, so grab your iced coffee. πβ¨
π NAME π
ERESI β The ERESI Reverse Engineering Software Interface. That's the whole name, iconic and to the point. π
πΈ SYNOPSIS πΈ
elfsh [OPTIONS]
etrace [OPTIONS]
e2dbg programtodebug
kernsh
π¦ DESCRIPTION π¦
Okay so ERESI β The ERESI Reverse Engineering Software Interface β is a unified reverse engineering framework for UNIX operating systems based on the Executable & Linking Format (ELF). We're talking Linux, BSD, Solaris, IRIX, and BeOS, bestie. π
It has a command line interface that makes it useful remotely, and it can generate graph images from code analysis on demand. It also has a real dedicated reverse engineering language that makes it scriptable and adaptable to the precise needs of the users. No cap, that's a big deal. π
ERESI contains more than 10 innovative and exclusive features that turn it into an environment of choice for the instrumentation, analysis, debugging, tracing, hooking, or simply integrity checking and events logging of binary programs. It's giving main character energy in a terminal. π
ERESI is composed of ELFsh (the ELF shell), E2dbg (The Embedded ELF debugger), and Etrace (The Embedded ELF tracer). This documentation applies on all of the components. π«Ά
β¨ OPTIONS β¨
The ELF shell (part of ERESI) can take the following command line parameters:
-fβ input file-wβ output file
Note that the command line is slightly different forE2dbgandEtrace, which do NOT take those parameters. π
π COMMANDS π
E2dbg and Etrace have to be executed using a unique command line parameter (the program file to be debugged or traced). The following primitives can be used interactively in E2dbg, Etrace, and ELFsh, but also on command line when preceded by a - (ELFsh only) at the UNIX shell command prompt. Periodt. π
π General purpose commands π
Here's the roster, exactly as listed:
cat edit exec exit help info list load lscripts nocolor profile quit sdir setcolor switch unload workspace
And here's the tea:
catβ print the file argumenteditβ Edit the file given in parameterexecβ Fork and execute parameter command (with args)helpβ Print the help screeninfoβ Print the extra details help screenlistβ List the loaded files and their IDload filenameβ Load input file filenamelscriptsβ List macro commandsnocolorβ Toggle color statusprofile (enable | disable) (traces | warns | alloc | debug | all)β Change theELFshprofiling behavior.
Traces profiling print all the internal function calls done by the framework. Warning profiling prints all the (fatal and non-fatal) warnings reported by the internal API : it's very useful for tracking bugs and it should be used when reporting issues on the bugtracking system. Allocation and debug profiling are experimental and should only be used by experienced ERESI developers. β¨
quitβ Quit the shell without savingsdirβ Change the script directory. This allows to make precise the location of complete ERESI library and bind script files on command names in the shell.setcolorβ Associates data types to colors.setcolor type [bg,fg] colorsetcolor type [underline,bold] (1=on,0=off)
Available types:
address, number, string, endstring, warnstring typestring, fieldstring, instr, pspecial, psname pspecial, pversion, prelease, pedition
Available colors:
black red green yellow blue magenta cyan white
switch (filename | fileID)β Change the current file to work on to filename or fileIDunload (filename | fileID)β Unload file filename or fileID without savingworkspace [wname]β When executed without parameter, this command list existing workspaces. When given an existing workspace name, this command switch to that workspace. If given a non-existing workspace name, this command creates a new workspace and switch to it.tables [regex]β If given without parameter, list all the existing hash tables in the ERESI framework. If given with a parameter, print the content of hash tables whose name match the regular expression.vectors [vname[:idx1:...:idxN]] [symbol|addr]β If given without parameter, list all the existing vectors in the ERESI framework. If given with a parameter, print the content of this vector. If given one long parameter, print the content of a given vector entry. If given 2 parameters, modify the vector entry with a user provided address or resolved symbol address.
π Ondisk/Memory ELF commands π
Those commands work in all components of the ERESI framework (ELFsh, E2dbg, and Etrace). The roster is:
add cmp ctors disasm div dtors dyn dynsym elf findrel get got hexa interp mod mul notes pht print redir rel reladd set sht sub write test
And here's the breakdown, bestie:
addβ Add the 2 parameters and put the result in variable$_cmpβ Compare 2 parameters. The difference is put in variable$_ct ctors [Regex]β Print.ctorssection entries matching RegexD disasm [Regex]β Disassemble matching binary objects in current file
disasm parameter
Allowed parameter format : regx regx:rva regx:rva%size regx%size
regx: Regular expression (mandatory)rva: Byte offset from the beginning (optional)size: Bytes number limit (optional)
divβ Divide first param by second one and put the result in the first onedt dtors [Regex]β Print.dtorssection entries matching Regexdynβ Print the ELF dynamic sectionds dynsym [Regex]β Print dynamic symtab (.dynsym) entries matching Regexe elfβ Print the ELF headerfindrelβ Try to find back stripped relocation information.
Note: retrieving this information in a very exact manner is very difficult, this command only gives you an approximative list of pointer accesses in the binary code. It does not deal either with constructed addresses using multiple arithmetic and logic instructions, or with false positives that appear to be valid mapped pointers but are not in reality (ex: Hashed data). π
getβ Print parameter object value. The parameter can be a constant or defined value, a variable or any ELF object that is part of any file loaded in the shell, provided you give its id at the beginning of the object path. Seeinfocommand for the exact grammar of object paths.g got [Regex]β Print the entries of the Global Offset Table (GOT) matching Regex. The regex can apply on either an address, an entry index, or a resolved symbol from the entry address (or contained address).X hexa [Regex]β Dump matching binary objects in current file. This has the same syntax thanD/disasmcommand.
X parameter
ParamFormat : regx regx:rva regx:rva%size regx%size
regx: Regular expression (mandatory)rva: Byte offset from the beginning (optional)size: Bytes number limit (optional)
interpβ Print ELF interpreter path standing in.interpsection.modβ Modulo operation between 2 parameters. The result is put in the destination variable.mulβ Multiply the 2 parameters. The result is put in the destination variable.n notes [Regex]β Print the Notes sections entries matching Regexp phtβ Print the Program Header Table (PHT)print [ObjectPath1 ObjectPath2 ... ObjectPathN]β Print the values of objects ObjectPath1 ObjectPath2 ... ObjectPathN. Objects can be constant strings, ELF objects, variables, defined values, and so on.redir func (func2 | addr)β Redirect calls to function func to func2 or address addr.
If the original function has a PLT entry, the ALTPLT technique is used to perform the redirection. If the function is internal (or if we are in a static binary) the CFLOW technique is used to perform the redirection. ALTPLT technique is available on INTEL, SPARC, MIPS, and ALPHA architectures. CFLOW technique is currently not available on the SPARC architecture. The hook (second) function is usually an injected C code provided by the user and injected using the reladd primitive. In case the provided hook function calls other function which are not in the host binary, ERESI will use the EXTPLT technique (or EXTSTATIC technique on static binaries) to relink the host binary in order to add new relocation entries, dynamic symbols with their names, symbol versions, extra GOT and PLT entries (using additionally the ALTGOT technique on RISC architectures), and will fixup the .dynamic section to reflect those changes on the section list. π₯
r rel [Regex]β Print the relocation entries matching Regexreladd (DestFilePath | DestfileID) (RelocFilePath | RelocFileID)β Inject the ELF relocatable object RelocFileID into the ELF executable object DestFileID. This command is used for injecting plain C compiled code linked into a.ofile into a hostET_EXEC(executable) orET_DYN(shared library) ELF file.set DestObjectPath SourceObjectPathβ Set the value of object DestObjectPath to SourceObjectPath. The$_variable gets modified depending on the result. See theinfocommand for a list of all accessible objects using thesetcommand.s sht [Regex]β Print the sections in the Section Header Table (SHT) matching Regexsubβ Substract 2nd parameter to the first one. The$_variable is modified depending on the result.write DestObjectPath SourceObjectPathβ Copy data from SourceObjectPath to DestObjectPath. The destination object has to be of type RAW (the data field of a section) and the source object has to be of type RAW or STRING. See theinfocommand for more detail about this.testβ it's in the roster above; this part doesn't give it a separate description.
π¦ Debugger commands π¦
Roster:
backtrace break continue dbgstack delete dumpregs linkmap stack step display threads itrace
backtraceβ Print backtrace (needs frame pointer).break (BPsymbol | 0xaddress)β Put a breakpoint on symbol or address. Print all breakpoints if given without parameter.stepβ Enable or disable stepping of debuggee program. Usecontinuefor singlestepping.continueβ Continue executing debuggee program after breakpoint or singlestep.delete (BPID | BPsymbol | 0xaddress)β Delete breakpoint by symbol, address, or ID.dbgstack WordsNBR
Okay so this one's a little orphan paragraph that's mid-command, but the facts are the facts bestie: it dumps N words from the debugger stack, where N is the first parameter. And the reason we can even do this? The debugger is embedded into the debuggee process. Iconic behaviour, honestly.
stackWordsNBR β dump WordsNBR words on the debuggee stack. π«Άdumpregsβ dump the registers of the debuggee, right at the breakpoint or step. Snap a pic of the CPU's whole mood.linkmapβ print the Linkmap list for the debuggee process. π¦displayBPid Full_ERESI_command β set a command to run on an event. First param has to be the breakpoint id that corresponds to the event, no cap. The ERESI command can be literally any valid ERESI command β including sourcing an ERESI script. Big main character energy for a breakpoint, tbh.threads[ThreadID] β with no parameter? It lists the existing threads in the debuggee process. With a thread ID parameter? The current thread gets switched to the thread indicated by that ID. Two moods, one command. β¨itraceβ singlestep the debuggee program until the next breakpoint event, printing all executed instructions until it stops. Prepare to be flooded, bestie π
π ELFsh modules commands
modhelp modload modunload β the module trio, the holy trinity, iykyk π
modhelpModuleFilePath β print help for a loaded ERESI module. Read the instructions, babe.modloadModuleFilePath β load an ERESI module. The path has to be absolute, or relative to the registered module path.modunloadModuleFilePath β unload an ERESI module. Same deal: absolute path, or relative to the registered module path.
π ELF objects flags
fixup shtrm sstrip β three little flag-setters that change the ELFsh internal descriptor, not the file. (Well, some of them save later. Keep reading π)
fixupβ mark the BSS section to be included in the disk file. The BSS gets immediately fixed in the ELFsh internal descriptor of the object.shtrmβ mark the Section Header Table as removed. Heads up: the SHT will be removed only when the file is saved, so it's a "later" kind of deal.sstripβ mark the Section Header Table (SHT) and the Symbol Table (.symtab) as stripped. Same vibe: they will be removed only when the file is saved.
π Nobody's deleting anything behind your back here β the removal waits for save. Periodt.
π¦ Ondisk only ELF commands
These commands only work in ELFsh, or in E2dbg when switched to the static mode using the mode command. So like, don't come at them from dynamic mode, they will not answer.
append extend flush insert remove save stab sym
appendSectionName SourceObjectPath β append the data of object SourceObjectPath to section SectionName.extendSectionName length β extend section SectionName with length zero bytes.flushβ flush all injected.ofiles from the current file.insertβ inject a new object (section, symbol, or program header) in the current working file. Here's the full syntax, verbatim:
insert sect name code|data|unmap [sz] [align]
sym name value [sz]
phdr type vaddr [sz]
removeβ remove an ELF object (section, symbol, or program header) from the current working file. And the shapes it takes:
remove sect name
sym name
phdr index
savefilename β dump the current selected file to the output file filename. Bestie, this command writes a file on disk. Like, actually on your actual disk. Be normal about it πdebugβ print unified debug format information for the current file.stsym[Regex] β print the symtab (.symtab) entries matching Regex.
π Kernsh modules commands
Those commands only work in Kernsh. Kernel girlies only, sorry to the userspace girlies π
openmemβ open kernel memory and static kernel.closememβ close kernel memory and static kernel.sctβ display the syscall table.idtβ display the interrupt descriptor table.gdtβ display the global descriptor table.allocβ alloc contiguous kernel memory.freeβ free contiguous kernel memory.alloc_ncβ alloc non contiguous kernel memory.free_ncβ free non contiguous kernel memory.kmoduleβ handle kernel module. And the sub-flavours are:kmodule -l module: load a lkmkmodule -u module: unload a lkmkmodule -r module1 module2 moduleout: link module with anotherkmodule -i module original_name evil_name: change lkm init (original_name) with another function (evil_name)
ksymβ get an address of a kernel symbol.kmd5sa output|sa:rva output|sa%rva%size output|sa%size outputβ make a md5sum. Breakdown, because there's a lot going on:sa: symbol or addrrva: byte offset from the beginning (optional)size: bytes number limit (optional) β and if size is0or not put, we search the end of the functionoutput: file output (optional)
kcmd5format|fileβ check a md5.format:addr:mode:size:off:md5file: filename
β Type related primitives
These primitives let you define and habitate types in the ERESI meta-language. Yes, "habitate". We stan a whole vocabulary πΈ
type[regex] β print the list of types (only the ones matching the regular expression, if one's given as a parameter).typename=field1:type1 ... fieldN:typeN β define a new type in the ERESI meta-language. Predefined types includebyte,short,int,caddr,daddr,long,hash,vector,string, andraw.typedeftname tname2 β copy and rename a type. And listen: any modification on one of the types will not affect the other. They're independent girlies, no codependency πinformtype [name | address] β make type name habitated by the variable standing at address name. If called with a single type name parameter, the command lists all variables that habitate this type. If given two parameters, the name is interpreted as a symbol pointing on a variable β its address is resolved and the type is informed about this variable. If only an address is given, its symbol is looked up and the variable corresponding to the symbol is informed. And if no symbol corresponds to that address? A new one is created that points on the address, and the newly symbolic variable is informed. Look at her go π₯uninformtype [name] β uninform a given variable from a type. If no variable name is given, all variables previously informed are removed from the type habitation. Total reset energy.
π Network commands
connect disconnect net netkill netlist peerslist rcmd
connectβ add a DUMP connection to given host.disconnectβ kill the DUMP connection from IP.netβ activate networking capabilities.netkillβ kill a network client by IP.netlistβ list connected network clients.peerslistβ list connected DUMP peers.rcmdβ execute a command on a remote machine. Remote bestie does it for you π
π Available prefixes
alert all quiet sort verb
alertβ alert prefix : change alert regular expression.a,allregex β set a global regular expression. All commands which take a regular expression as a parameter will default to use this global regular expression. Set it once, slay everywhere β¨quietβ toggle the quiet flag (do not print executed commands).sortβ sorting prefix (use a-addr-ors -size-).verbβ toggle the verbose flag (undo the quiet flag).
π§ Available Script jumps
A certain number of jumps construct are available, and here's the whole squad:
je jg jge jl jle jmp jne
jeβ jump on label if equal (use lastcmpresult).jgβ jump on label if greater (use lastcmpresult).jgeβ jump on label if greater or equal (use lastcmpresult).jlβ jump on label if lower (use lastcmpresult).jleβ jump on label if lower or equal (use lastcmpresult).jmpβ unconditional jump to script label.jneβ jump on label if nont equal (use lastcmpresult).
π And yes, the page literally says "nont equal". Not me fixing it. The facts stay the facts.
You might also consider using a foreach construct, which is not described in this manual page. Rude of it, honestly.
π Available modules
modflow modremap modtest
modflowβ Modflow is an ELFsh module designed to perform control flow analysis on ELF binaries. For detailed examples and usage, seeREADMEinELFsh/modules/modflow.modremapβ "Modflow is an ELFsh module designed to perform remapping sections in Elf binaries" β that's verbatim what the page says, π, and seeELFsh/modules/modremapfor further details.modtestβ Modtest is a ElFsh module designed to show the usage of adding new commands to ELFsh. SeeELFsh/modules/modtestfor further details. (Yes: "a ElFsh". We keep it. π)
π¦ OBJECT PATH FORMAT π¦
okay so this section is literally the map for grabbing different objects inside an ELF file. for most commands, the object can also be a decimal or hexadecimal number β and when that happens, the ObjectPath is that number. no cap.
π§ ELF Header π§
the shape is filename.hdrfield, bestie.
ELF header fields are:
magicβ Magic numberclassβ File classtypeβ Object file typemachineβ Architectureversionβ Object file versionentryβ Entry point virtual addressphoffβ Program header table file offsetshoffβ Section header table file offsetflagsβ Processor-specific Flagsehsizeβ Size of the ELF header in bytesphentsizeβ Size of the program headersshentsizeβ Size of the section headersphnumβ Number of program headersshnumβ Number of section headersshstrndxβ Section header string table indexpax_pageexecβ PAX use paging based non-executable pagespax_emultrampβ PAX emulate trampolinespax_mprotectβ PAX restrict mmappax_randmmapβ PAX randomize mmappax_randexecβ PAX randomly map executable addresspax_segmexecβ PAX use segmentation based non-executable pages
π got/ctors/dtors tables π
the format is (filename | fileID).(got|ctors|dtors)[index].
in this command, the index can also be a symbol name that corresponds to the requested GOT, CTORS, OR DTORS entry. iykyk.
πΈ Program segment header table πΈ
you reach these with (filename | fileID).pht[index].fi eld.
Program segment header table entry fields are:
typeβ Segment typeoffsetβ Segment file offsetpaddrβ Segment physical addressvaddrβ Segment virtual addressfileszβ Segment size in filememszβ Segment size in memoryflagsβ Segment flagsalignβ Segment alignment
π Symbol/Dynamic symbol tables π
the path is (filename | fileID).(symtab|dynsym)[index].fi eld.
Symbol/Dynamic symbol table entry fields are:
nameβ Symbol namevalueβ Symbol valuesizeβ Symbol sizebindβ Symbol bindingtypeβ Symbol typeotherβ Symbol visibility
β¨ Dynamic section β¨
hit it with (filename | fileID).dynamic[index].fi eld.
the .dynamic section entry fields are:
valβ Integer or address valuetagβ Dynamic entry type
π Section header table π
the format is (filename | fileID).sht[index].fi eld.
the index can be the name of the section. Section Header Table entries fields are:
typeβ Section typeoffsetβ Section Offset in ELF fileaddrβ Section Addresssizeβ Section Size in byteslinkβ Link to another sectioninfoβ Additional Infoalignβ Section Alignmententsizeβ Entry size if section holds tableflagsβ section flag letters:aβ Section occupies memory during executionwβ Section is Writeablexβ Section is Executablesβ Contains nul-terminated stringsmβ Section might be mergedlβ Preserve order after combiningoβ OS specific
π¦ Relocation table π¦
the path is (filename | fileID).rel[indextable][indexentry].fi eld.
Relocation entry fields are:
typeβ Relocation Typesymβ Relocation symbol indexoffsetβ Address
π Additional sections information π
the format is (filename | fileID).section[sectionindex].fi eld.
π heads up: the section object is not a real object of the binary, but a kind of virtual one. it holds all the information about a section that do not stand in the sectoin header table entries.
Section fields are:
nameβ Section namerawβ Section Raw data
to access, use this path format:
filename.section[index[:offset[%elemsize]]].raw
β¨ AUTHOR β¨
ERESI was created by Julien Vanegue and developed by the ERESI team.
<team at eresi-project dot antispam org>
the complete list of ERESI contributors can be found on the website:
this manual page was created by Julien Vanegue, from previous work on the ELFsh man page by Peter De Schrijver for the Debian GNU/Linux system. additional improvements were made by stingduk for version 0.7. iconic.
π SEE ALSO π
and thatβs the whole ERESI(1) page, bestie β brought to you by ERESI 0.78, dated May 2007, and filed under ERESI(1). slay. π β¨
π¦ where this page comes from
- nixos 26.05: eresi 0.83-a3-phoenix
- nixpkgs unstable: eresi 0.83-a3-phoenix
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms