Rizin
unix-like reverse engineering framework and cli tools
io_zip.c File Reference
#include <rz_io.h>
#include <rz_lib.h>
#include <rz_util.h>
#include <rz_cons.h>
#include <zip.h>

Go to the source code of this file.

Classes

struct  rz_io_zip_uri_const_t
 
struct  rz_io_zfo_t
 

Typedefs

typedef struct rz_io_zip_uri_const_t RzIOZipConstURI
 
typedef struct rz_io_zfo_t RzIOZipFileObj
 

Enumerations

enum  RZ_IO_ZIP_ARCHIVE_TYPE {
  RZ_IO_PARENT_ZIP = 0x0001 , RZ_IO_CHILD_FILE = 0x0002 , RZ_IO_NEW_FILE = 0x0004 , RZ_IO_EXISTING_FILE = 0x0008 ,
  RZ_IO_MODIFIED_FILE = 0x0010 , RZ_IO_DELETED_FILE = 0x0020
}
 

Functions

static int rz_io_zip_has_uri_substr (const char *file)
 
static int rz_io_zip_check_uri_many (const char *file)
 
static int rz_io_zip_check_uri (const char *file)
 
static bool rz_io_zip_plugin_open (RzIO *io, const char *file, bool many)
 
struct ziprz_io_zip_open_archive (const char *archivename, ut32 perm, int mode, int rw)
 
static int rz_io_zip_slurp_file (RzIOZipFileObj *zfo)
 
RzListrz_io_zip_get_files (const char *archivename, ut32 perm, int mode, int rw)
 
int rz_io_zip_flush_file (RzIOZipFileObj *zfo)
 
static void rz_io_zip_free_zipfileobj (RzIOZipFileObj *zfo)
 
RzIOZipFileObjrz_io_zip_create_new_file (const char *archivename, const char *filename, struct zip_stat *sb, ut32 perm, int mode, int rw)
 
RzIOZipFileObjrz_io_zip_alloc_zipfileobj (const char *archivename, const char *filename, ut32 perm, int mode, int rw)
 
static RzListrz_io_zip_open_many (RzIO *io, const char *file, int rw, int mode)
 
char * rz_io_zip_get_by_file_idx (const char *archivename, const char *idx, ut32 perm, int mode, int rw)
 
static char * find_ipa_binary (const char *filename, int rw, int mode)
 
static char * find_apk_binary (const char *filename, int rw, int mode, RzIO *io)
 
static RzIODescrz_io_zip_open (RzIO *io, const char *file, int rw, int mode)
 
static ut64 rz_io_zip_lseek (RzIO *io, RzIODesc *fd, ut64 offset, int whence)
 
static int rz_io_zip_read (RzIO *io, RzIODesc *fd, ut8 *buf, int count)
 
static int rz_io_zip_realloc_buf (RzIOZipFileObj *zfo, int count)
 
static bool rz_io_zip_truncate_buf (RzIOZipFileObj *zfo, int size)
 
static bool rz_io_zip_resize (RzIO *io, RzIODesc *fd, ut64 size)
 
static int rz_io_zip_write (RzIO *io, RzIODesc *fd, const ut8 *buf, int count)
 
static int rz_io_zip_close (RzIODesc *fd)
 

Variables

static RzIOZipConstURI ZIP_URIS []
 
static RzIOZipConstURI ZIP_ALL_URIS []
 
RzIOPlugin rz_io_plugin_zip
 
RZ_API RzLibStruct rizin_plugin
 

Typedef Documentation

◆ RzIOZipConstURI

◆ RzIOZipFileObj

typedef struct rz_io_zfo_t RzIOZipFileObj

Enumeration Type Documentation

◆ RZ_IO_ZIP_ARCHIVE_TYPE

Enumerator
RZ_IO_PARENT_ZIP 
RZ_IO_CHILD_FILE 
RZ_IO_NEW_FILE 
RZ_IO_EXISTING_FILE 
RZ_IO_MODIFIED_FILE 
RZ_IO_DELETED_FILE 

Definition at line 11 of file io_zip.c.

11  {
12  RZ_IO_PARENT_ZIP = 0x0001,
13  RZ_IO_CHILD_FILE = 0x0002,
14  RZ_IO_NEW_FILE = 0x0004,
15  RZ_IO_EXISTING_FILE = 0x0008,
16  RZ_IO_MODIFIED_FILE = 0x0010,
17  RZ_IO_DELETED_FILE = 0x0020,
RZ_IO_ZIP_ARCHIVE_TYPE
Definition: io_zip.c:11
@ RZ_IO_DELETED_FILE
Definition: io_zip.c:17
@ RZ_IO_PARENT_ZIP
Definition: io_zip.c:12
@ RZ_IO_EXISTING_FILE
Definition: io_zip.c:15
@ RZ_IO_CHILD_FILE
Definition: io_zip.c:13
@ RZ_IO_NEW_FILE
Definition: io_zip.c:14
@ RZ_IO_MODIFIED_FILE
Definition: io_zip.c:16

Function Documentation

◆ find_apk_binary()

static char* find_apk_binary ( const char *  filename,
int  rw,
int  mode,
RzIO io 
)
static

Definition at line 409 of file io_zip.c.

409  {
410  RzList *files = NULL;
411  RzListIter *iter = NULL;
412  char *name = NULL;
413  RzIOZipFileObj *zfo = NULL;
414  char *zip_filename = rz_str_newf("//%s//classes.dex", filename);
416 
417  if (files) {
418  rz_list_foreach (files, iter, name) {
419  /* Find matching file */
420  if (!strcmp(name, "classes.dex")) {
421  continue;
422  } else if (rz_str_endswith(name, ".dex")) {
423  RZ_LOG_INFO("Adding extra IO descriptor to file %s\n", name);
425  if (!zfo) {
426  eprintf("Error: cannot allocate zip file object.\n");
427  continue;
428  }
429  if (zfo->entry == -1) {
430  if (!rw) {
431  eprintf("Warning: File %s does not exist.\n", name);
433  continue;
434  }
435  eprintf("Warning: File %s does not exist, creating a new one.\n", name);
436  }
437  zfo->io_backref = io;
438  RzIODesc *desc = rz_io_desc_new(io, &rz_io_plugin_zip, zfo->name, rw, mode, zfo);
439  desc->name = strdup(name);
440  rz_io_desc_add(io, desc);
441  }
442  }
444  }
445 
446  return zip_filename;
447 }
const char * desc
Definition: bin_vsf.c:19
#define NULL
Definition: cris-opc.c:27
checking print the parsed form of the magic use in n conjunction with m to debug a new magic file n before installing it n output MIME type special files
Definition: file_opts.h:46
RzList * rz_io_zip_get_files(const char *archivename, ut32 perm, int mode, int rw)
Definition: io_zip.c:160
RzIOPlugin rz_io_plugin_zip
Definition: io_zip.c:675
RzIOZipFileObj * rz_io_zip_alloc_zipfileobj(const char *archivename, const char *filename, ut32 perm, int mode, int rw)
Definition: io_zip.c:252
static void rz_io_zip_free_zipfileobj(RzIOZipFileObj *zfo)
Definition: io_zip.c:223
const char * filename
Definition: ioapi.h:137
const char int mode
Definition: ioapi.h:137
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
Definition: list.c:137
#define ZIP_CREATE
Definition: zip.h:67
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
#define eprintf(x, y...)
Definition: rlcc.c:7
RZ_API bool rz_io_desc_add(RzIO *io, RzIODesc *desc)
Definition: io_desc.c:49
RZ_API RzIODesc * rz_io_desc_new(RzIO *io, RzIOPlugin *plugin, const char *uri, int flags, int mode, void *data)
Definition: io_desc.c:11
#define RZ_LOG_INFO(fmtstr,...)
Definition: rz_log.h:54
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API bool rz_str_endswith(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string ends with a specifc sequence of characters (case sensitive)
Definition: str.c:3329
Definition: z80asm.h:102
char * name
Definition: io_zip.c:42
ut64 entry
Definition: io_zip.c:48
RzIO * io_backref
Definition: io_zip.c:54

References desc, rz_io_zfo_t::entry, eprintf, files, rz_io_zfo_t::io_backref, rz_io_zfo_t::name, NULL, rz_io_desc_add(), rz_io_desc_new(), rz_io_plugin_zip, rz_io_zip_alloc_zipfileobj(), rz_io_zip_free_zipfileobj(), rz_io_zip_get_files(), rz_list_free(), RZ_LOG_INFO, rz_str_endswith(), rz_str_newf(), strdup(), and ZIP_CREATE.

Referenced by rz_io_zip_open().

◆ find_ipa_binary()

static char* find_ipa_binary ( const char *  filename,
int  rw,
int  mode 
)
static

Definition at line 376 of file io_zip.c.

376  {
377  RzList *files = NULL;
378  RzListIter *iter;
379  char *name;
380  int app_size = 0;
381  const char *app_name;
382  const char *last_slash;
383 
384  char *zip_filename = NULL;
386 
387  rz_list_foreach (files, iter, name) {
388  /* Find matching file */
389  app_name = strstr(name, ".app/");
390  if (!app_name) {
391  continue;
392  }
393  last_slash = rz_str_rchr(name, app_name, '/');
394  if (!last_slash) {
395  continue;
396  }
397  app_size = (app_name - last_slash) - 1;
398  zip_filename = rz_str_newf("//Payload/%.*s.app/%.*s", app_size, last_slash + 1, app_size, last_slash + 1);
399  if (zip_filename && !strcmp(name, zip_filename + 2)) {
400  break;
401  }
402  RZ_FREE(zip_filename);
403  }
405 
406  return zip_filename;
407 }
const char * name
Definition: op.c:541
RZ_API const char * rz_str_rchr(const char *base, const char *p, int ch)
Definition: str.c:829
#define RZ_FREE(x)
Definition: rz_types.h:369

References files, name, NULL, RZ_FREE, rz_io_zip_get_files(), rz_list_free(), rz_str_newf(), and rz_str_rchr().

Referenced by rz_io_zip_open().

◆ rz_io_zip_alloc_zipfileobj()

RzIOZipFileObj* rz_io_zip_alloc_zipfileobj ( const char *  archivename,
const char *  filename,
ut32  perm,
int  mode,
int  rw 
)

Definition at line 252 of file io_zip.c.

252  {
253  RzIOZipFileObj *zfo = NULL;
254  ut64 i, num_entries;
255  struct zip_stat sb;
256  struct zip *zipArch = rz_io_zip_open_archive(archivename, perm, mode, rw);
257  if (!zipArch) {
258  return NULL;
259  }
260  num_entries = zip_get_num_files(zipArch);
261 
262  for (i = 0; i < num_entries; i++) {
263  zip_stat_init(&sb);
264  zip_stat_index(zipArch, i, 0, &sb);
265  if (sb.name != NULL) {
266  if (strcmp(sb.name, filename) == 0) {
268  archivename, filename, &sb,
269  perm, mode, rw);
271  break;
272  }
273  }
274  }
275  if (!zfo) {
276  zfo = rz_io_zip_create_new_file(archivename,
277  filename, NULL, perm, mode, rw);
278  }
279  zip_close(zipArch);
280  return zfo;
281 }
lzma_index ** i
Definition: index.h:629
static SblHeader sb
Definition: bin_mbn.c:26
struct zip * rz_io_zip_open_archive(const char *archivename, ut32 perm, int mode, int rw)
Definition: io_zip.c:95
RzIOZipFileObj * rz_io_zip_create_new_file(const char *archivename, const char *filename, struct zip_stat *sb, ut32 perm, int mode, int rw)
Definition: io_zip.c:236
static int rz_io_zip_slurp_file(RzIOZipFileObj *zfo)
Definition: io_zip.c:122
ZIP_EXTERN int zip_get_num_files(zip_t *_Nonnull)
ZIP_EXTERN void zip_stat_init(zip_stat_t *_Nonnull)
Definition: zip_stat_init.c:40
ZIP_EXTERN int zip_close(zip_t *_Nonnull)
Definition: zip_close.c:52
ZIP_EXTERN int zip_stat_index(zip_t *_Nonnull, zip_uint64_t, zip_flags_t, zip_stat_t *_Nonnull)
Definition: zip.h:300
Definition: zipint.h:278
ut64(WINAPI *w32_GetEnabledXStateFeatures)()

References i, NULL, rz_io_zip_create_new_file(), rz_io_zip_open_archive(), rz_io_zip_slurp_file(), sb, ut64(), zip_close(), zip_get_num_files(), zip_stat_index(), and zip_stat_init().

Referenced by find_apk_binary(), rz_io_zip_open(), and rz_io_zip_open_many().

◆ rz_io_zip_check_uri()

static int rz_io_zip_check_uri ( const char *  file)
static

Definition at line 73 of file io_zip.c.

73  {
74  int i;
76  for (i = 0; ZIP_URIS[i].name != NULL; i++) {
77  if (!strncmp(file, ZIP_URIS[i].name, ZIP_URIS[i].len) && file[ZIP_URIS[i].len]) {
78  return true;
79  }
80  }
81  }
82  return false;
83 }
size_t len
Definition: 6502dis.c:15
static RzIOZipConstURI ZIP_URIS[]
Definition: io_zip.c:25
static int rz_io_zip_has_uri_substr(const char *file)
Definition: io_zip.c:57
Definition: gzappend.c:170
const char * name
Definition: io_zip.c:21

References i, len, rz_io_zip_uri_const_t::name, NULL, rz_io_zip_has_uri_substr(), and ZIP_URIS.

Referenced by rz_io_zip_plugin_open().

◆ rz_io_zip_check_uri_many()

static int rz_io_zip_check_uri_many ( const char *  file)
static

Definition at line 61 of file io_zip.c.

61  {
62  int i;
64  for (i = 0; ZIP_ALL_URIS[i].name != NULL; i++) {
65  if (!strncmp(file, ZIP_ALL_URIS[i].name, ZIP_ALL_URIS[i].len) && file[ZIP_ALL_URIS[i].len]) {
66  return true;
67  }
68  }
69  }
70  return false;
71 }
static RzIOZipConstURI ZIP_ALL_URIS[]
Definition: io_zip.c:33

References i, len, rz_io_zip_uri_const_t::name, NULL, rz_io_zip_has_uri_substr(), and ZIP_ALL_URIS.

Referenced by rz_io_zip_plugin_open().

◆ rz_io_zip_close()

static int rz_io_zip_close ( RzIODesc fd)
static

Definition at line 664 of file io_zip.c.

664  {
665  RzIOZipFileObj *zfo;
666  if (!fd || !fd->data) {
667  return -1;
668  }
669  zfo = fd->data;
671  zfo = fd->data = NULL;
672  return 0;
673 }
static const z80_opcode fd[]
Definition: z80_tab.h:997

References fd, NULL, and rz_io_zip_free_zipfileobj().

◆ rz_io_zip_create_new_file()

RzIOZipFileObj* rz_io_zip_create_new_file ( const char *  archivename,
const char *  filename,
struct zip_stat sb,
ut32  perm,
int  mode,
int  rw 
)

Definition at line 236 of file io_zip.c.

236  {
238  if (zfo) {
239  zfo->b = rz_buf_new_with_bytes(NULL, 0);
240  zfo->archivename = strdup(archivename);
241  zfo->name = strdup(sb ? sb->name : filename);
242  zfo->entry = !sb ? -1 : sb->index;
243  zfo->fd = rz_num_rand(0xFFFF); // XXX: Use rz_io_fd api
244  zfo->perm = perm;
245  zfo->mode = mode;
246  zfo->rw = rw;
247  }
248  return zfo;
249 }
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
RZ_API int rz_num_rand(int max)
Definition: unum.c:47
#define RZ_NEW0(x)
Definition: rz_types.h:284
RzBuffer * b
Definition: io_zip.c:51
int mode
Definition: io_zip.c:44
int perm
Definition: io_zip.c:49
char * archivename
Definition: io_zip.c:43
int rw
Definition: io_zip.c:45
int fd
Definition: io_zip.c:46

References rz_io_zfo_t::archivename, rz_io_zfo_t::b, rz_io_zfo_t::entry, rz_io_zfo_t::fd, rz_io_zfo_t::mode, rz_io_zfo_t::name, NULL, rz_io_zfo_t::perm, rz_io_zfo_t::rw, rz_buf_new_with_bytes(), RZ_NEW0, rz_num_rand(), sb, and strdup().

Referenced by rz_io_zip_alloc_zipfileobj().

◆ rz_io_zip_flush_file()

int rz_io_zip_flush_file ( RzIOZipFileObj zfo)

Definition at line 188 of file io_zip.c.

188  {
189  int res = false;
190  struct zip *zipArch;
191 
192  if (!zfo) {
193  return res;
194  }
195 
196  zipArch = rz_io_zip_open_archive(
197  zfo->archivename, zfo->perm, zfo->mode, zfo->rw);
198  if (!zipArch) {
199  return res;
200  }
201 
202  ut64 tmpsz;
203  const ut8 *tmp = rz_buf_data(zfo->b, &tmpsz);
204  struct zip_source *s = zip_source_buffer(zipArch, tmp, tmpsz, 0);
205  if (s && zfo->entry != -1) {
206  if (zip_replace(zipArch, zfo->entry, s) == 0) {
207  res = true;
208  }
209  } else if (s && zfo->name) {
210  if (zip_add(zipArch, zfo->name, s) == 0) {
211  zfo->entry = zip_name_locate(zipArch, zfo->name, 0);
212  res = true;
213  }
214  }
215  // s (zip_source) is freed when the archive is closed, i think - dso
216  zip_close(zipArch);
217  if (s) {
219  }
220  return res;
221 }
uint8_t ut8
Definition: lh5801.h:11
ZIP_EXTERN zip_int64_t zip_name_locate(zip_t *_Nonnull, const char *_Nonnull, zip_flags_t)
ZIP_EXTERN zip_int64_t zip_add(zip_t *_Nonnull, const char *_Nonnull, zip_source_t *_Nonnull)
Definition: zip_add.c:47
ZIP_EXTERN void zip_source_free(zip_source_t *_Nullable)
ZIP_EXTERN int zip_replace(zip_t *_Nonnull, zip_uint64_t, zip_source_t *_Nonnull)
Definition: zip_replace.c:40
ZIP_EXTERN zip_source_t *_Nullable zip_source_buffer(zip_t *_Nonnull, const void *_Nullable, zip_uint64_t, int)
static RzSocket * s
Definition: rtr.c:28
RZ_DEPRECATE RZ_API RZ_BORROW ut8 * rz_buf_data(RZ_NONNULL RzBuffer *b, RZ_NONNULL RZ_OUT ut64 *size)
Return a borrowed array of bytes representing the buffer data.
Definition: buf.c:1287

References rz_io_zfo_t::archivename, rz_io_zfo_t::b, rz_io_zfo_t::entry, rz_io_zfo_t::mode, rz_io_zfo_t::name, rz_io_zfo_t::perm, rz_io_zfo_t::rw, rz_buf_data(), rz_io_zip_open_archive(), s, autogen_x86imm::tmp, ut64(), zip_add(), zip_close(), zip_name_locate(), zip_replace(), zip_source_buffer(), and zip_source_free().

Referenced by rz_io_zip_free_zipfileobj(), rz_io_zip_resize(), and rz_io_zip_write().

◆ rz_io_zip_free_zipfileobj()

static void rz_io_zip_free_zipfileobj ( RzIOZipFileObj zfo)
static

Definition at line 223 of file io_zip.c.

223  {
224  if (!zfo) {
225  return;
226  }
227  if (zfo->modified) {
229  }
230  free(zfo->name);
231  free(zfo->password);
232  rz_buf_free(zfo->b);
233  free(zfo);
234 }
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
int rz_io_zip_flush_file(RzIOZipFileObj *zfo)
Definition: io_zip.c:188
RZ_API void rz_buf_free(RzBuffer *b)
Free all internal data hold by the buffer and the buffer.
Definition: buf.c:1253
char * password
Definition: io_zip.c:52
ut8 modified
Definition: io_zip.c:50

References rz_io_zfo_t::b, free(), rz_io_zfo_t::modified, rz_io_zfo_t::name, rz_io_zfo_t::password, rz_buf_free(), and rz_io_zip_flush_file().

Referenced by find_apk_binary(), and rz_io_zip_close().

◆ rz_io_zip_get_by_file_idx()

char* rz_io_zip_get_by_file_idx ( const char *  archivename,
const char *  idx,
ut32  perm,
int  mode,
int  rw 
)

Definition at line 348 of file io_zip.c.

348  {
349  char *filename = NULL;
350  ut64 i, num_entries;
351  ut32 file_idx = -1;
352  struct zip_stat sb;
353  struct zip *zipArch = rz_io_zip_open_archive(archivename, perm, mode, rw);
354  if (!idx || !zipArch) {
355  zip_close(zipArch);
356  return filename;
357  }
358  num_entries = zip_get_num_files(zipArch);
359  file_idx = atoi(idx);
360  if ((file_idx == 0 && idx[0] != '0') || (file_idx >= num_entries)) {
361  zip_close(zipArch);
362  return filename;
363  }
364  for (i = 0; i < num_entries; i++) {
365  zip_stat_init(&sb);
366  zip_stat_index(zipArch, i, 0, &sb);
367  if (file_idx == i) {
368  filename = strdup(sb.name);
369  break;
370  }
371  }
372  zip_close(zipArch);
373  return filename;
374 }
uint32_t ut32
int idx
Definition: setup.py:197

References i, setup::idx, NULL, rz_io_zip_open_archive(), sb, strdup(), ut64(), zip_close(), zip_get_num_files(), zip_stat_index(), and zip_stat_init().

Referenced by rz_io_zip_open().

◆ rz_io_zip_get_files()

RzList* rz_io_zip_get_files ( const char *  archivename,
ut32  perm,
int  mode,
int  rw 
)

Definition at line 160 of file io_zip.c.

160  {
161  struct zip *zipArch = rz_io_zip_open_archive(archivename, perm, mode, rw);
162  ut64 num_entries = 0, i = 0;
163  struct zip_stat sb;
164  char *name = NULL;
165  RzList *files = NULL;
166  if (!zipArch) {
167  return NULL;
168  }
169 
171  if (!files) {
172  zip_close(zipArch);
173  return NULL;
174  }
175 
176  num_entries = zip_get_num_files(zipArch);
177  for (i = 0; i < num_entries; i++) {
178  zip_stat_init(&sb);
179  zip_stat_index(zipArch, i, 0, &sb);
180  if ((name = strdup(sb.name))) {
182  }
183  }
184  zip_close(zipArch);
185  return files;
186 }
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
Definition: list.c:248
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
Definition: list.c:288

References files, free(), i, NULL, rz_io_zip_open_archive(), rz_list_append(), rz_list_newf(), sb, strdup(), ut64(), zip_close(), zip_get_num_files(), zip_stat_index(), and zip_stat_init().

Referenced by find_apk_binary(), find_ipa_binary(), rz_io_zip_open(), and rz_io_zip_open_many().

◆ rz_io_zip_has_uri_substr()

static int rz_io_zip_has_uri_substr ( const char *  file)
static

Definition at line 57 of file io_zip.c.

57  {
58  return (file && strstr(file, "://"));
59 }

Referenced by rz_io_zip_check_uri(), and rz_io_zip_check_uri_many().

◆ rz_io_zip_lseek()

static ut64 rz_io_zip_lseek ( RzIO io,
RzIODesc fd,
ut64  offset,
int  whence 
)
static

Definition at line 568 of file io_zip.c.

568  {
569  RzIOZipFileObj *zfo;
570  ut64 seek_val = 0;
571 
572  if (!fd || !fd->data) {
573  return -1;
574  }
575 
576  zfo = fd->data;
577  seek_val = rz_buf_tell(zfo->b);
578 
579  switch (whence) {
580  case SEEK_SET:
581  seek_val = (rz_buf_size(zfo->b) < offset) ? rz_buf_size(zfo->b) : offset;
582  io->off = seek_val;
583  rz_buf_seek(zfo->b, seek_val, RZ_BUF_SET);
584  return seek_val;
585  case SEEK_CUR:
586  seek_val = (rz_buf_size(zfo->b) < (offset + rz_buf_tell(zfo->b))) ? rz_buf_size(zfo->b) : offset + rz_buf_tell(zfo->b);
587  io->off = seek_val;
588  rz_buf_seek(zfo->b, seek_val, RZ_BUF_SET);
589  return seek_val;
590  case SEEK_END:
591  seek_val = rz_buf_size(zfo->b);
592  io->off = seek_val;
593  rz_buf_seek(zfo->b, seek_val, RZ_BUF_SET);
594  return seek_val;
595  }
596  return seek_val;
597 }
voidpf uLong offset
Definition: ioapi.h:144
RZ_API ut64 rz_buf_tell(RZ_NONNULL RzBuffer *b)
Return the current cursor position.
Definition: buf.c:1238
RZ_API st64 rz_buf_seek(RZ_NONNULL RzBuffer *b, st64 addr, int whence)
Modify the current cursor position in the buffer.
Definition: buf.c:1166
#define RZ_BUF_SET
Definition: rz_buf.h:14
RZ_API ut64 rz_buf_size(RZ_NONNULL RzBuffer *b)
Return the size of the buffer.
Definition: buf.c:1225
#define b(i)
Definition: sha256.c:42
ut64 off
Definition: rz_io.h:61
#define SEEK_SET
Definition: zip.c:88
#define SEEK_CUR
Definition: zip.c:80
#define SEEK_END
Definition: zip.c:84

References rz_io_zfo_t::b, fd, rz_io_t::off, rz_buf_seek(), RZ_BUF_SET, rz_buf_size(), rz_buf_tell(), SEEK_CUR, SEEK_END, SEEK_SET, and ut64().

◆ rz_io_zip_open()

static RzIODesc* rz_io_zip_open ( RzIO io,
const char *  file,
int  rw,
int  mode 
)
static

Definition at line 449 of file io_zip.c.

449  {
450  RzIODesc *res = NULL;
451  char *uri_path, *tmp;
452  RzIOZipFileObj *zfo = NULL;
453  char *zip_uri = NULL, *zip_filename = NULL, *filename_in_zipfile = NULL;
454 
455  if (!rz_io_zip_plugin_open(io, file, false)) {
456  return NULL;
457  }
458  zip_uri = strdup(file);
459  if (!zip_uri) {
460  return NULL;
461  }
462  uri_path = strstr(zip_uri, "://");
463  if (uri_path) {
464  tmp = strstr(uri_path + 3, "//");
465  zip_filename = tmp ? strdup(tmp) : NULL;
466  // 1) Tokenize to the '//' and find the base file directory ('/')
467  if (!zip_filename) {
468  if (!strncmp(zip_uri, "apk://", 6)) {
469  zip_filename = find_apk_binary(uri_path + 3, rw, mode, io);
470  } else if (!strncmp(zip_uri, "ipa://", 6)) {
471  zip_filename = find_ipa_binary(uri_path + 3, rw, mode);
472  } else {
473  zip_filename = strdup(uri_path + 1);
474  }
475  } else {
476  free(zip_filename);
477  zip_filename = strdup(uri_path + 1);
478  }
479  }
480  tmp = zip_filename;
481  if (zip_filename && zip_filename[1] && zip_filename[2]) {
482  if (zip_filename[0] && zip_filename[0] == '/' &&
483  zip_filename[1] && zip_filename[1] == '/') {
484  *zip_filename++ = 0;
485  }
486  *zip_filename++ = 0;
487 
488  // check for // for file in the archive
489  if ((filename_in_zipfile = strstr(zip_filename, "//")) && filename_in_zipfile[2]) {
490  // null terminating uri to filename here.
491  *filename_in_zipfile++ = 0;
492  *filename_in_zipfile++ = 0;
493  filename_in_zipfile = strdup(filename_in_zipfile);
494  // check for :: index
495  } else if ((filename_in_zipfile = strstr(zip_filename, "::")) &&
496  filename_in_zipfile[2]) {
497  // null terminating uri to filename here.
498  *filename_in_zipfile++ = 0;
499  *filename_in_zipfile++ = 0;
500  filename_in_zipfile = rz_io_zip_get_by_file_idx(
501  zip_filename, filename_in_zipfile,
502  ZIP_CREATE, mode, rw);
503  } else {
504  filename_in_zipfile = rz_str_newf("%s", zip_filename);
505  RZ_FREE(tmp);
506  zip_filename = strdup(uri_path + 3);
507  if (!strcmp(zip_filename, filename_in_zipfile)) {
508  // RZ_FREE (zip_filename);
509  RZ_FREE(filename_in_zipfile);
510  }
511  }
512  }
513 
514  if (!zip_filename) { // && !filename_in_zipfile) {
515  // free (zip_uri);
516  eprintf("usage: zip:///path/to/archive//filepath\n"
517  "usage: zip:///path/to/archive::[number]\n"
518  "Archive was not found.\n");
519  // return res;
520  }
521 
522  // Failed to find the file name the archive.
523  if (!filename_in_zipfile) {
524  RzList *files = NULL;
525  RzListIter *iter;
526  char *name;
527  // eprintf("usage: zip:///path/to/archive//filepath\n");
528  files = rz_io_zip_get_files(zip_filename, 0, mode, rw);
529  if (files) {
530  ut32 i = 0;
531  rz_list_foreach (files, iter, name) {
532  io->cb_printf("%d %s\n", i, name);
533  i++;
534  }
536  }
537  goto done;
538  }
539  // eprintf("After parsing the given uri: %s\n", file);
540  // eprintf("Zip filename the given uri: %s\n", zip_filename);
541  // eprintf("File in the zip: %s\n", filename_in_zipfile);
542  zfo = rz_io_zip_alloc_zipfileobj(zip_filename,
543  filename_in_zipfile, ZIP_CREATE, mode, rw);
544 
545  if (zfo) {
546  if (zfo->entry == -1) {
547  eprintf("Warning: File %s does not exist, creating a new one.\n", filename_in_zipfile);
548  }
549  zfo->io_backref = io;
550  res = rz_io_desc_new(io, &rz_io_plugin_zip,
551  zfo->name, rw, mode, zfo);
552  }
553 
554  if (!res) {
555  eprintf("Failed to open the archive %s and file %s\n",
556  zip_filename, filename_in_zipfile);
557  // free (zfo); zfo is already freed by rz_io_desc_new
558  rz_io_desc_free(res);
559  res = NULL;
560  }
561 done:
562  free(filename_in_zipfile);
563  free(zip_uri);
564  free(tmp);
565  return res;
566 }
struct tab * done
Definition: enough.c:233
static bool rz_io_zip_plugin_open(RzIO *io, const char *file, bool many)
Definition: io_zip.c:85
static char * find_apk_binary(const char *filename, int rw, int mode, RzIO *io)
Definition: io_zip.c:409
static char * find_ipa_binary(const char *filename, int rw, int mode)
Definition: io_zip.c:376
char * rz_io_zip_get_by_file_idx(const char *archivename, const char *idx, ut32 perm, int mode, int rw)
Definition: io_zip.c:348
RZ_API void rz_io_desc_free(RzIODesc *desc)
Definition: io_desc.c:35
PrintfCallback cb_printf
Definition: rz_io.h:91

References rz_io_t::cb_printf, done, rz_io_zfo_t::entry, eprintf, files, find_apk_binary(), find_ipa_binary(), free(), i, rz_io_zfo_t::io_backref, name, rz_io_zfo_t::name, NULL, RZ_FREE, rz_io_desc_free(), rz_io_desc_new(), rz_io_plugin_zip, rz_io_zip_alloc_zipfileobj(), rz_io_zip_get_by_file_idx(), rz_io_zip_get_files(), rz_io_zip_plugin_open(), rz_list_free(), rz_str_newf(), strdup(), autogen_x86imm::tmp, and ZIP_CREATE.

◆ rz_io_zip_open_archive()

struct zip* rz_io_zip_open_archive ( const char *  archivename,
ut32  perm,
int  mode,
int  rw 
)

Definition at line 95 of file io_zip.c.

95  {
96  struct zip *zipArch = NULL;
97  int zip_errorp;
98  if (!archivename) {
99  return NULL;
100  }
101  if ((zipArch = zip_open(archivename, perm, &zip_errorp))) {
102  return zipArch;
103  }
104  if (zip_errorp == ZIP_ER_INVAL) {
105  eprintf("ZIP File Error: Invalid file name (NULL).\n");
106  } else if (zip_errorp == ZIP_ER_OPEN) {
107  eprintf("ZIP File Error: File could not be opened file name.\n");
108  } else if (zip_errorp == ZIP_ER_NOENT) {
109  eprintf("ZIP File Error: File does not exist.\n");
110  } else if (zip_errorp == ZIP_ER_READ) {
111  eprintf("ZIP File Error: Read error occurred.\n");
112  } else if (zip_errorp == ZIP_ER_NOZIP) {
113  eprintf("ZIP File Error: File is not a valid ZIP archive.\n");
114  } else if (zip_errorp == ZIP_ER_INCONS) {
115  eprintf("ZIP File Error: ZIP file had some inconsistencies archive.\n");
116  } else {
117  eprintf("ZIP File Error: Something bad happened, get your debug on.\n");
118  }
119  return NULL;
120 }
#define ZIP_ER_OPEN
Definition: zip.h:116
#define ZIP_ER_NOENT
Definition: zip.h:114
#define ZIP_ER_INVAL
Definition: zip.h:123
ZIP_EXTERN zip_t *_Nullable zip_open(const char *_Nonnull, int, int *_Nullable)
Definition: zip_open.c:54
#define ZIP_ER_NOZIP
Definition: zip.h:124
#define ZIP_ER_INCONS
Definition: zip.h:126
#define ZIP_ER_READ
Definition: zip.h:110

References eprintf, NULL, ZIP_ER_INCONS, ZIP_ER_INVAL, ZIP_ER_NOENT, ZIP_ER_NOZIP, ZIP_ER_OPEN, ZIP_ER_READ, and zip_open().

Referenced by rz_io_zip_alloc_zipfileobj(), rz_io_zip_flush_file(), rz_io_zip_get_by_file_idx(), rz_io_zip_get_files(), and rz_io_zip_slurp_file().

◆ rz_io_zip_open_many()

static RzList* rz_io_zip_open_many ( RzIO io,
const char *  file,
int  rw,
int  mode 
)
static

Definition at line 284 of file io_zip.c.

284  {
285  RzList *list_fds = NULL;
286  RzListIter *iter;
287  RzList *filenames = NULL;
288  RzIODesc *res = NULL;
289  RzIOZipFileObj *zfo = NULL;
290  char *filename_in_zipfile, *zip_filename = NULL, *zip_uri;
291 
292  if (!rz_io_zip_plugin_open(io, file, true)) {
293  return NULL;
294  }
295 
296  zip_uri = strdup(file);
297  if (!zip_uri) {
298  return NULL;
299  }
300  // 1) Tokenize to the '//' and find the base file directory ('/')
301  zip_filename = strstr(zip_uri, "//");
302  if (zip_filename && zip_filename[2]) {
303  if (zip_filename[0] && zip_filename[0] == '/' &&
304  zip_filename[1] && zip_filename[1] == '/') {
305  *zip_filename++ = 0;
306  }
307  *zip_filename++ = 0;
308  } else {
309  free(zip_uri);
310  return NULL;
311  }
312 
313  filenames = rz_io_zip_get_files(zip_filename, 0, mode, rw);
314 
315  if (!filenames) {
316  free(zip_uri);
317  return NULL;
318  }
319 
320  list_fds = rz_list_new();
321  rz_list_foreach (filenames, iter, filename_in_zipfile) {
322  size_t v = strlen(filename_in_zipfile);
323 
324  if (filename_in_zipfile[v - 1] == '/') {
325  continue;
326  }
327 
328  zfo = rz_io_zip_alloc_zipfileobj(zip_filename,
329  filename_in_zipfile, ZIP_CREATE, mode, rw);
330 
331  if (zfo && zfo->entry == -1) {
332  eprintf("Warning: File did not exist, creating a new one.\n");
333  }
334 
335  if (zfo) {
336  zfo->io_backref = io;
337  res = rz_io_desc_new(io, &rz_io_plugin_zip,
338  zfo->name, rw, mode, zfo);
339  }
340  rz_list_append(list_fds, res);
341  }
342 
343  free(zip_uri);
344  rz_list_free(filenames);
345  return list_fds;
346 }
const char * v
Definition: dsignal.c:12
RZ_API RZ_OWN RzList * rz_list_new(void)
Returns a new initialized RzList pointer (free method is not initialized)
Definition: list.c:235

References rz_io_zfo_t::entry, eprintf, free(), rz_io_zfo_t::io_backref, rz_io_zfo_t::name, NULL, rz_io_desc_new(), rz_io_plugin_zip, rz_io_zip_alloc_zipfileobj(), rz_io_zip_get_files(), rz_io_zip_plugin_open(), rz_list_append(), rz_list_free(), rz_list_new(), strdup(), v, and ZIP_CREATE.

◆ rz_io_zip_plugin_open()

static bool rz_io_zip_plugin_open ( RzIO io,
const char *  file,
bool  many 
)
static

Definition at line 85 of file io_zip.c.

85  {
86  if (io && file) {
87  if (many) {
89  }
90  return rz_io_zip_check_uri(file);
91  }
92  return false;
93 }
static int rz_io_zip_check_uri(const char *file)
Definition: io_zip.c:73
static int rz_io_zip_check_uri_many(const char *file)
Definition: io_zip.c:61

References rz_io_zip_check_uri(), and rz_io_zip_check_uri_many().

Referenced by rz_io_zip_open(), and rz_io_zip_open_many().

◆ rz_io_zip_read()

static int rz_io_zip_read ( RzIO io,
RzIODesc fd,
ut8 buf,
int  count 
)
static

Definition at line 599 of file io_zip.c.

599  {
600  RzIOZipFileObj *zfo = NULL;
601  if (!fd || !fd->data || !buf) {
602  return -1;
603  }
604  zfo = fd->data;
605  if (rz_buf_size(zfo->b) < io->off) {
606  io->off = rz_buf_size(zfo->b);
607  }
608  int r = rz_buf_read_at(zfo->b, io->off, buf, count);
609  if (r >= 0) {
610  rz_buf_seek(zfo->b, r, RZ_BUF_CUR);
611  }
612  return r;
613 }
#define r
Definition: crypto_rc6.c:12
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
Definition: sflib.h:98
voidpf void * buf
Definition: ioapi.h:138
#define RZ_BUF_CUR
Definition: rz_buf.h:15
RZ_API st64 rz_buf_read_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL RZ_OUT ut8 *buf, ut64 len)
Read len bytes of the buffer at the specified address.
Definition: buf.c:1136

References rz_io_zfo_t::b, count, fd, NULL, rz_io_t::off, r, RZ_BUF_CUR, rz_buf_read_at(), rz_buf_seek(), and rz_buf_size().

◆ rz_io_zip_realloc_buf()

static int rz_io_zip_realloc_buf ( RzIOZipFileObj zfo,
int  count 
)
static

Definition at line 615 of file io_zip.c.

615  {
616  return rz_buf_resize(zfo->b, rz_buf_tell(zfo->b) + count);
617 }
RZ_API bool rz_buf_resize(RZ_NONNULL RzBuffer *b, ut64 newsize)
Resize the buffer size.
Definition: buf.c:890

References rz_io_zfo_t::b, count, rz_buf_resize(), and rz_buf_tell().

Referenced by rz_io_zip_write().

◆ rz_io_zip_resize()

static bool rz_io_zip_resize ( RzIO io,
RzIODesc fd,
ut64  size 
)
static

Definition at line 623 of file io_zip.c.

623  {
624  RzIOZipFileObj *zfo;
625  if (!fd || !fd->data) {
626  return false;
627  }
628  zfo = fd->data;
629  if (rz_io_zip_truncate_buf(zfo, size)) {
630  zfo->modified = 1;
632  return true;
633  }
634  return false;
635 }
static bool rz_io_zip_truncate_buf(RzIOZipFileObj *zfo, int size)
Definition: io_zip.c:619
voidpf void uLong size
Definition: ioapi.h:138

References fd, rz_io_zfo_t::modified, rz_io_zip_flush_file(), and rz_io_zip_truncate_buf().

◆ rz_io_zip_slurp_file()

static int rz_io_zip_slurp_file ( RzIOZipFileObj zfo)
static

Definition at line 122 of file io_zip.c.

122  {
123  struct zip_file *zFile = NULL;
124  struct zip *zipArch;
125  struct zip_stat sb;
126  bool res = false;
127  if (!zfo) {
128  return res;
129  }
130  zipArch = rz_io_zip_open_archive(
131  zfo->archivename, zfo->perm,
132  zfo->mode, zfo->rw);
133 
134  if (zipArch && zfo && zfo->entry != -1) {
135  zFile = zip_fopen_index(zipArch, zfo->entry, 0);
136  if (!zFile) {
137  zip_close(zipArch);
138  return false;
139  }
140  if (!zfo->b) {
141  zfo->b = rz_buf_new_with_bytes(NULL, 0);
142  }
143  zip_stat_init(&sb);
144  if (zfo->b && !zip_stat_index(zipArch, zfo->entry, 0, &sb)) {
145  ut8 *buf = calloc(1, sb.size);
146  if (buf) {
147  zip_fread(zFile, buf, sb.size);
148  rz_buf_set_bytes(zfo->b, buf, sb.size);
149  res = true;
150  zfo->opened = true;
151  free(buf);
152  }
153  }
154  zip_fclose(zFile);
155  }
156  zip_close(zipArch);
157  return res;
158 }
ZIP_EXTERN int zip_fclose(zip_file_t *_Nonnull)
Definition: zip_fclose.c:41
ZIP_EXTERN zip_int64_t zip_fread(zip_file_t *_Nonnull, void *_Nonnull, zip_uint64_t)
Definition: zip_fread.c:39
ZIP_EXTERN zip_file_t *_Nullable zip_fopen_index(zip_t *_Nonnull, zip_uint64_t, zip_flags_t)
void * calloc(size_t number, size_t size)
Definition: malloc.c:102
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
int opened
Definition: io_zip.c:47

References rz_io_zfo_t::archivename, rz_io_zfo_t::b, calloc(), rz_io_zfo_t::entry, free(), rz_io_zfo_t::mode, NULL, rz_io_zfo_t::opened, rz_io_zfo_t::perm, rz_io_zfo_t::rw, rz_buf_new_with_bytes(), rz_buf_set_bytes(), rz_io_zip_open_archive(), sb, zip_close(), zip_fclose(), zip_fopen_index(), zip_fread(), zip_stat_index(), and zip_stat_init().

Referenced by rz_io_zip_alloc_zipfileobj().

◆ rz_io_zip_truncate_buf()

static bool rz_io_zip_truncate_buf ( RzIOZipFileObj zfo,
int  size 
)
static

Definition at line 619 of file io_zip.c.

619  {
620  return rz_buf_resize(zfo->b, size > 0 ? size : 0);
621 }

References rz_io_zfo_t::b, and rz_buf_resize().

Referenced by rz_io_zip_resize().

◆ rz_io_zip_write()

static int rz_io_zip_write ( RzIO io,
RzIODesc fd,
const ut8 buf,
int  count 
)
static

Definition at line 637 of file io_zip.c.

637  {
638  RzIOZipFileObj *zfo;
639  int ret = 0;
640  if (!fd || !fd->data || !buf) {
641  return -1;
642  }
643  zfo = fd->data;
644  if (!(zfo->perm & RZ_PERM_W)) {
645  return -1;
646  }
647  if (rz_buf_tell(zfo->b) + count >= rz_buf_size(zfo->b)) {
649  }
650  if (rz_buf_size(zfo->b) < io->off) {
651  io->off = rz_buf_size(zfo->b);
652  }
653  zfo->modified = 1;
654  ret = rz_buf_write_at(zfo->b, io->off, buf, count);
655  if (ret >= 0) {
656  rz_buf_seek(zfo->b, ret, RZ_BUF_CUR);
657  }
658  // XXX - Implement a flush of some sort, but until then, lets
659  // just write through
661  return ret;
662 }
static int rz_io_zip_realloc_buf(RzIOZipFileObj *zfo, int count)
Definition: io_zip.c:615
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
#define RZ_PERM_W
Definition: rz_types.h:94

References rz_io_zfo_t::b, count, fd, rz_io_zfo_t::modified, rz_io_t::off, rz_io_zfo_t::perm, RZ_BUF_CUR, rz_buf_seek(), rz_buf_size(), rz_buf_tell(), rz_buf_write_at(), rz_io_zip_flush_file(), rz_io_zip_realloc_buf(), and RZ_PERM_W.

Variable Documentation

◆ rizin_plugin

RZ_API RzLibStruct rizin_plugin
Initial value:
= {
.type = RZ_LIB_TYPE_IO,
.data = &rz_io_plugin_zip,
}
@ RZ_LIB_TYPE_IO
Definition: rz_lib.h:69
#define RZ_VERSION
Definition: rz_version.h:8
const char * version
Definition: rz_io.h:117

Definition at line 691 of file io_zip.c.

◆ rz_io_plugin_zip

RzIOPlugin rz_io_plugin_zip
Initial value:
= {
.name = "zip",
.desc = "Open zip files",
.uris = "zip://,apk://,ipa://,jar://,zipall://,apkall://,ipaall://,jarall://",
.license = "BSD",
.open = rz_io_zip_open,
.open_many = rz_io_zip_open_many,
.write = rz_io_zip_write,
.read = rz_io_zip_read,
.close = rz_io_zip_close,
.lseek = rz_io_zip_lseek,
.resize = rz_io_zip_resize,
}
static ut64 rz_io_zip_lseek(RzIO *io, RzIODesc *fd, ut64 offset, int whence)
Definition: io_zip.c:568
static RzIODesc * rz_io_zip_open(RzIO *io, const char *file, int rw, int mode)
Definition: io_zip.c:449
static int rz_io_zip_read(RzIO *io, RzIODesc *fd, ut8 *buf, int count)
Definition: io_zip.c:599
static bool rz_io_zip_resize(RzIO *io, RzIODesc *fd, ut64 size)
Definition: io_zip.c:623
static int rz_io_zip_close(RzIODesc *fd)
Definition: io_zip.c:664
static RzList * rz_io_zip_open_many(RzIO *io, const char *file, int rw, int mode)
Definition: io_zip.c:284
static int rz_io_zip_write(RzIO *io, RzIODesc *fd, const ut8 *buf, int count)
Definition: io_zip.c:637

Definition at line 675 of file io_zip.c.

Referenced by find_apk_binary(), rz_io_zip_open(), and rz_io_zip_open_many().

◆ ZIP_ALL_URIS

RzIOZipConstURI ZIP_ALL_URIS[]
static
Initial value:
= {
{ "zipall://", 9 },
{ "apkall://", 9 },
{ "ipaall://", 9 },
{ "jarall://", 9 },
{ NULL, 0 }
}

Definition at line 33 of file io_zip.c.

Referenced by rz_io_zip_check_uri_many().

◆ ZIP_URIS

RzIOZipConstURI ZIP_URIS[]
static
Initial value:
= {
{ "zip://", 6 },
{ "apk://", 6 },
{ "ipa://", 6 },
{ "jar://", 6 },
{ NULL, 0 }
}

Definition at line 25 of file io_zip.c.

Referenced by rz_io_zip_check_uri().