void swf_destroy_imageguts (swf_imageguts * guts) { if (guts==NULL) { return; } swf_free (guts->data); swf_free (guts); return; }
void swf_destroy_mp3header (swf_mp3header * header) { if (header==NULL) { return; } swf_free (header->data); swf_free (header); return; }
void swf_destroy_placeobject2 (swf_placeobject2 * object) { if (object==NULL) { return; } swf_destroy_matrix (object->matrix); swf_destroy_cxform (object->cxform); swf_free (object->name); swf_free (object); return; }
int main (int argc, char *argv[]) { swf_matrix *m1, *m2, *m3; int error; if ((m1 = (swf_matrix *) calloc (1, sizeof (swf_matrix))) == NULL) { error = SWF_EMallocFailure; return 1; } if ((m2 = (swf_matrix *) calloc (1, sizeof (swf_matrix))) == NULL) { error = SWF_EMallocFailure; return 1; } if ((m3 = (swf_matrix *) calloc (1, sizeof (swf_matrix))) == NULL) { error = SWF_EMallocFailure; return 1; } m1->a = m1->d = 2 * 256 * 256; m1->b = m1->c = 0; m1->tx = 0 * 20; m1->ty = 0 * 20; m2->a = 1.2 * 256 * 256; m2->b = 3.4 * 256 * 256; m2->c = 2 * 256 * 256; m2->d = 0; m2->tx = 0 * 20; m2->ty = 0 * 20; printf ("Matrix 1\n"); print_matrix(m1, "aaah"); printf ("\nMatrix 2\n"); print_matrix(m2, "baah"); m3 = swf_matrix_mult(m1, m2); printf ("\nMatrix 3\n"); print_matrix(m3, "mewp"); swf_free(m3); swf_free(m2); swf_free(m1); printf("\nDone\n"); return 0; }
void swf_destroy_doaction (swf_doaction * action) { if (action==NULL) { return; } swf_free (action->url); swf_free (action->target); swf_free (action->goto_label); swf_free (action->push_data_string); swf_free (action); return; }
void swf_destroy_startsound (swf_startsound * sound) { int i = 0; if (sound==NULL) { return; } for (i=0; i<sound->npoints; i++) { swf_destroy_soundpoint(sound->points[i]); } swf_free (sound->points); swf_free (sound); return; }
void swf_destroy_mp3header_list (swf_mp3header_list * list) { int i=0; if (list==NULL) { return; } for (i=0; i<list->header_count; i++) { swf_destroy_mp3header(list->headers[i]); } swf_free (list->headers); swf_free (list); return; }
void swf_destroy_adpcm (swf_adpcm * adpcm) { if (adpcm==NULL) { return; } swf_free (adpcm); return; }
void swf_destroy_cxform (swf_cxform * cxform) { if (cxform==NULL) { return; } swf_free (cxform); return; }
/* clean up after ourselves */ void destroy_swf (swf_extractor * swf) { int i; dprintf ("[destroy_swf : freeing %d strings]\n", swf->num_strings); /* delete each individual string */ for (i=0; i< swf->num_strings; i++) { swf_free (swf->strings[i]); } swf->num_strings = 0; /* delete the pointer to the strings */ swf_free (swf->strings); dprintf ("[destroy_swf : freeing %d urls]\n", swf->num_urls); /* delete each individual url */ for (i=0; i<swf->num_urls; i++) { swf_free (swf->urls[i]); } swf->num_urls = 0; /* delete the pointer to the urls */ swf_free (swf->urls); dprintf ("[destroy_swf : destroying parser]\n"); /* destroy the parser, which may be NULL */ swf_destroy_parser (swf->parser); dprintf ("[destroy_swf : destroying context]\n"); /* free the context */ swf_free (swf); /* and we're done! */ }
void swf_destroy_definebitsjpeg3 (swf_definebitsjpeg3 * bits) { if (bits==NULL) { return; } swf_destroy_imageguts (bits->guts); swf_free (bits); return; }
void swf_destroy_definesound (swf_definesound * sound) { if (sound==NULL) { return; } swf_destroy_mp3header_list (sound->mp3header_list); swf_destroy_adpcm (sound->adpcm); swf_free (sound); return; }
void swf_destroy_soundstreamblock (swf_soundstreamblock * block) { if (block==NULL) { return; } swf_destroy_adpcm (block->adpcm); swf_destroy_mp3header_list (block->mp3header_list); swf_free (block); return; }
void swf_destroy_definefont2 (swf_definefont2 * font) { int i=0; if (font==NULL) { return; } for (i=0; i<font->glyph_count; i++) { swf_destroy_shaperecord_list (font->glyphs[i]); if (font->bounds) swf_destroy_rect (font->bounds[i]); } swf_free (font->glyphs); swf_free (font->name); swf_free (font->code_table); swf_free (font->bounds); for (i=0; i<font->nkerning_pairs; i++) { swf_destroy_kerningpair (font->kerning_pairs[i]); } swf_free(font->kerning_pairs); swf_free (font); }
void swf_destroy_definebutton2 (swf_definebutton2 * button) { if (button==NULL) { return; } swf_destroy_buttonrecord_list(button->records); swf_destroy_button2action_list (button->actions); swf_free (button); return; }
void swf_destroy_definetext2 (swf_definetext2 * text) { if (text==NULL) { return; } swf_destroy_rect (text->rect); swf_destroy_matrix (text->matrix); swf_destroy_textrecord_list (text->records); swf_free (text); return; }
int main(int argc, char *argv[]){ if(argc < 2){ fprintf(stderr, "NOT ENOUGH ARGUMENTS\n"); return 1; } FILE *file = fopen(argv[1], "r"); if(!file){ fprintf(stderr, "BAD FILE\n"); return 1; } SWFParser *parser = swf_parser_init(); unsigned i = 0; SWFParserCallbacks callbacks = { .priv = &i, .tag_cb = tag_cb, .header_cb = header_cb, .header2_cb = header2_cb, }; swf_parser_set_callbacks(parser, &callbacks); SWF *swf = swf_parser_get_swf(parser); uint8_t data[1024 * 1024]; while(1){ size_t read = fread(data, 1, sizeof(data), file); if(read == 0){ int err = ferror(file); if(err){ fprintf(stderr, "FERROR: %i\n", err); }else{ fprintf(stderr, "EOF: %i\n", feof(file)); } break; } SWFError ret = swf_parser_append(parser, data, read); if(ret < 0){ fprintf(stderr, "ERROR: %i\n", ret); return 1; }else if(ret == SWF_FINISHED){ break; } } swf_free(swf); swf_parser_free(parser); fclose(file); printf("Finished.\n"); return 0; }
void swf_destroy_definemorphshape (swf_definemorphshape * shape) { int i, j; if (shape==NULL) { return; } swf_destroy_rect (shape->r1); swf_destroy_rect (shape->r2); for (i=0; i<shape->nfills; i++) { swf_free (shape->fills[i]->matrix1); swf_free (shape->fills[i]->matrix2); for (j=0; j<shape->fills[i]->ncolours; j++) { swf_free (shape->fills[i]->colours[j]); } swf_free (shape->fills[i]->colours); swf_free (shape->fills[i]); } swf_free (shape->fills); for (i=0; i<shape->nlines; i++) { swf_free (shape->lines[i]); } swf_free (shape->lines); swf_destroy_shaperecord_list(shape->records1); swf_destroy_shaperecord_list(shape->records2); swf_free (shape); }
void parse_definetext (swf_extractor * swf, int * error) { swf_definetext * text = text = swf_parse_definetext (swf->parser, error); char * string = NULL; dprintf ("[parse_definetext: text is %s ]\n", (text==NULL)?"NULL":"Ok"); if (text == NULL || *error != SWF_ENoError) { dprintf ("[parse_definetext : fail! error was '%s']\n", swf_error_code_to_string (*error)); return; } dprintf ("[parse_definetext: getting text records ]\n"); string = swf_parse_textrecords_to_text(swf->parser, error, text->records); dprintf ("[parse_definetext: got text record]\n"); if (string==NULL) { goto FAIL; } dprintf ("[parse_definetext: text record is '%s']\n", string); if (*error == SWF_ENoError) { add_string (swf, error, string); } dprintf ("[parse_definetext: text record is '%s']\n", string); swf_free (string); FAIL: swf_destroy_definetext (text); dprintf ("[parse_definetext : have destroyed definetext]\n"); }
void parse_definetext2 (swf_extractor * swf, int * error) { swf_definetext2 * text = swf_parse_definetext2 (swf->parser, error); char * string = NULL; if (text == NULL || *error != SWF_ENoError) { return; } string = swf_parse_textrecords_to_text(swf->parser, error, text->records); if (*error == SWF_ENoError) { add_string (swf, error, string); } swf_free (string); swf_destroy_definetext2 (text); }
void print_textrecords (swf_textrecord_list * list, const char * str, swf_parser * context) { swf_textrecord * tmp; swf_textrecord * node; int error = SWF_ENoError; char * text = NULL; text = swf_parse_textrecords_to_text(context, &error, list); node = list->first; while (node != NULL) { tmp = node; node = node->next; print_textrecord (tmp, str); } if (text!=NULL) { printf ("%s\ttext representation : %s\n", str, text); } swf_free (text); }
int main (int argc, char *argv[]) { swf_movie * movie; int error = SWF_ENoError; swf_parser * parser; swf_header * hdr; swf_tagrecord * temp; swf_matrix * m3; if ((m3 = (swf_matrix *) calloc (1, sizeof (swf_matrix))) == NULL) { error = SWF_EMallocFailure; return 1; } /* First, get a parser up */ parser = swf_parse_create("swfs/ibm.swf", &error); if (parser == NULL) { fprintf (stderr, "Failed to create SWF context\n"); return -1; } printf ("Name of file is '%s'\n", parser->name); printf("----- Reading the file input header -----\n"); hdr = swf_parse_header(parser, &error); if (hdr == NULL) { fprintf (stderr, "Failed to parse headers\n"); exit(1); } printf("FWS\n"); printf("File version \t%"pSWF_U32"\n", hdr->version); printf("File size \t%"pSWF_U32"\n", hdr->size); printf("Movie width \t%lu\n", (hdr->bounds->xmax - hdr->bounds->xmin) / 20); printf("Movie height \t%lu\n", (hdr->bounds->ymax - hdr->bounds->ymin) / 20); printf("Xmin: \t%lu\n", (hdr->bounds->xmin / 20)); printf("Xmax: \t%lu\n", (hdr->bounds->xmax / 20)); printf("Ymin: \t%lu\n", (hdr->bounds->ymin / 20)); printf("Ymax: \t%lu\n", (hdr->bounds->ymax / 20)); printf("Frame rate \t%"pSWF_U32"\n", hdr->rate); printf("Frame count \t%"pSWF_U32"\n", hdr->count); printf("\n----- Reading movie details -----\n"); /* Now generate the output movie */ if ((movie = swf_make_movie(&error)) == NULL) { fprintf (stderr, "Fail\n"); return 1; } /* Right, now we need a tagrecord.. */ temp = swf_make_triangle(movie, &error); /* Need to calloc a (raw) buffer for temp... */ if ((temp->buffer->raw = (SWF_U8 *) calloc (10240, sizeof (SWF_U8))) == NULL) { fprintf (stderr, "Calloc Fail\n"); return 1; } swf_serialise_defineshape(temp->buffer, &error, (swf_defineshape *) temp->tag); temp->serialised = 1; /* Ensure we import a good header... */ movie->header = hdr; movie->name = (char *) "ben4.swf"; movie->header->rate = FRAMERATE * 256; /* Do the frames */ swf_add_setbackgroundcolour(movie, &error, 0, 255, 0, 255); swf_dump_tag(movie, &error, temp); m3->a = m3->d = 1 * 256 * 256; m3->b = m3->c = 0; m3->tx = 0 * 20; m3->ty = 0 * 20; swf_add_placeobject(movie, &error, m3, 1, 2); swf_add_showframe(movie, &error); swf_add_end(movie, &error); swf_make_finalise(movie, &error); printf("foo 3\n"); swf_destroy_movie(movie); printf("foo 4\n"); swf_destroy_parser(parser); swf_free(m3); fprintf (stderr, "OK\n"); return 0; }
swf_definefont2 * swf_parse_definefont2 (swf_parser * context, int * error) { swf_definefont2 * font; int i, n, data_pos; SWF_U32 code_offset; SWF_U32 * offset_table; swf_font_extra *extra; if ((font = (swf_definefont2 *) calloc (1, sizeof (swf_definefont2))) == NULL) { *error = SWF_EMallocFailure; return NULL; } font->name = NULL; font->code_table = NULL; font->glyphs = NULL; font->kerning_pairs = NULL; font->bounds = NULL; font->fontid = swf_parse_get_word (context); font->flags = swf_parse_get_word (context); font->name_len = swf_parse_get_byte (context); if ((font->name = (char *) calloc (font->name_len, sizeof(char))) == NULL) { *error = SWF_EMallocFailure; goto FAIL; } for (i=0; i<font->name_len; i++) { font->name[i] = (char) swf_parse_get_byte(context); } /* Get the number of glyphs. */ font->glyph_count = swf_parse_get_word(context); if (font->glyph_count > 0) { if (!(extra = swf_fetch_font_extra(context, font->fontid, font->glyph_count))) { *error = SWF_EMallocFailure; goto FAIL; } data_pos = swf_parse_tell(context); /* Get the FontOffsetTable */ if ((offset_table = (SWF_U32 *) calloc (font->glyph_count, sizeof (SWF_U32))) == NULL) { *error = SWF_EMallocFailure; goto FAIL; } for (n=0; n<font->glyph_count; n++) { if (font->flags & sfontFlagsWideOffsets) { offset_table[n] = swf_parse_get_dword(context); } else { offset_table[n] = swf_parse_get_word(context); } } /* Get the CodeOffset */ code_offset = 0; if (font->flags & sfontFlagsWideOffsets) { code_offset = swf_parse_get_dword(context); } else { code_offset = swf_parse_get_word(context); } /* Get the Glyphs */ if ((font->glyphs = (swf_shaperecord_list **) calloc (font->glyph_count, sizeof(swf_shaperecord_list *))) == NULL) { goto FAIL; } for(n=0; n<font->glyph_count; n++) { swf_parse_seek (context, data_pos + offset_table[n]); swf_parse_initbits (context); /* reset bit counter */ /* todo simon : do these really need to be set in the context? */ context->fill_bits = (SWF_U16) swf_parse_get_bits(context, 4); context->line_bits = (SWF_U16) swf_parse_get_bits(context, 4); font->glyphs[n] = (swf_shaperecord_list *) swf_parse_get_shaperecords(context, error); } swf_free (offset_table); if (swf_parse_tell (context) != data_pos + code_offset) { /* todo simon : should I return NULL here? */ swf_parse_seek(context, data_pos + code_offset); } if ((font->code_table = (SWF_U32 *) calloc (font->glyph_count, sizeof (SWF_U32))) == NULL) { *error = SWF_EMallocFailure; goto FAIL; } /* Get the CodeTable */ for (i=0; i<font->glyph_count; i++) { if (font->flags & sfontFlagsWideOffsets) { font->code_table [i] = swf_parse_get_word (context); } else { font->code_table [i] = swf_parse_get_byte (context); } } } if (font->flags & sfontFlagsHasLayout) { /* Get "layout" fields */ font->ascent = swf_parse_get_word (context); font->descent = swf_parse_get_word (context); font->leading = swf_parse_get_word (context); /* Skip Advance table */ /* todo simon : does this need to be done ???*/ swf_parse_skip (context, font->glyph_count * 2); /* Get BoundsTable */ if ((font->bounds = (swf_rect **) calloc (font->glyph_count, sizeof(swf_rect*))) == NULL) { *error = SWF_EMallocFailure; goto FAIL; } for (i=0; i<font->glyph_count; i++) { if ((font->bounds[i] = swf_parse_get_rect (context, error)) == NULL) { goto FAIL; } } /* * Get Kerning Pairs */ font->nkerning_pairs = swf_parse_get_word (context); if (font->nkerning_pairs && (font->kerning_pairs = (swf_kerningpair **) calloc (font->nkerning_pairs, sizeof(swf_kerningpair *))) == NULL) { *error = SWF_EMallocFailure; goto FAIL; } for (i=0; i<font->nkerning_pairs; i++) { if ((font->kerning_pairs[i] = (swf_kerningpair *) calloc (1, sizeof(swf_kerningpair))) == NULL) { *error = SWF_EMallocFailure; goto FAIL; } if (font->flags & sfontFlagsWideOffsets) { font->kerning_pairs[i]->code1 = swf_parse_get_word (context); font->kerning_pairs[i]->code2 = swf_parse_get_word (context); } else { font->kerning_pairs[i]->code1 = swf_parse_get_byte (context); font->kerning_pairs[i]->code2 = swf_parse_get_byte (context); } font->kerning_pairs[i]->adjust = swf_parse_get_word(context); } } return font; FAIL: swf_destroy_definefont2 (font); return NULL; }
int main (int argc, char *argv[]) { swf_movie * movie; int error = SWF_ENoError; int shape_num; swf_parser * parser; swf_header * hdr; swf_tagrecord * temp; SWF_U16 obj_id; swf_matrix *matrix, *m2, *m3; swf_cxform *mycx, *cx2; int i; char * myname; if (argc < 3) { usage(argv[0]); exit (1); } /* First, get a parser up */ parser = swf_parse_create(argv[1], &error); shape_num = atoi(argv[2]); if (parser == NULL) { fprintf (stderr, "Failed to create SWF context\n"); return -1; } printf ("Name of file is '%s'\n", parser->name); printf("----- Reading the file input header -----\n"); hdr = swf_parse_header(parser, &error); if (hdr == NULL) { fprintf (stderr, "Failed to parse headers\n"); exit(1); } hdr->version = 5; printf("FWS\n"); printf("File version \t%"pSWF_U32"\n", hdr->version); printf("File size \t%"pSWF_U32"\n", hdr->size); printf("Movie width \t%lu\n", (hdr->bounds->xmax - hdr->bounds->xmin) / 20); printf("Movie height \t%lu\n", (hdr->bounds->ymax - hdr->bounds->ymin) / 20); printf("Xmin: \t%lu\n", (hdr->bounds->xmin / 20)); printf("Xmax: \t%lu\n", (hdr->bounds->xmax / 20)); printf("Ymin: \t%lu\n", (hdr->bounds->ymin / 20)); printf("Ymax: \t%lu\n", (hdr->bounds->ymax / 20)); printf("Frame rate \t%"pSWF_U32"\n", hdr->rate); printf("Frame count \t%"pSWF_U32"\n", hdr->count); printf("\n----- Reading movie details -----\n"); if ((matrix = (swf_matrix *) calloc (1, sizeof (swf_matrix))) == NULL) { error = SWF_EMallocFailure; return 1; } if ((mycx = (swf_cxform *) calloc (1, sizeof (swf_cxform))) == NULL) { error = SWF_EMallocFailure; return 1; } if ((m2 = (swf_matrix *) calloc (1, sizeof (swf_matrix))) == NULL) { error = SWF_EMallocFailure; return 1; } if ((m3 = (swf_matrix *) calloc (1, sizeof (swf_matrix))) == NULL) { error = SWF_EMallocFailure; return 1; } if ((cx2 = (swf_cxform *) calloc (1, sizeof (swf_cxform))) == NULL) { error = SWF_EMallocFailure; return 1; } mycx->ra = 0; mycx->ga = 0; mycx->ba = 0; mycx->aa = 0; mycx->ab = 0; cx2->ra = 0; cx2->ga = 0; cx2->ba = 0; cx2->aa = 0; cx2->ab = 0; /* Now generate the output movie */ if ((movie = swf_make_movie(&error)) == NULL) { fprintf (stderr, "Fail\n"); return 1; } /* Ensure we import a good header... */ movie->header = hdr; movie->name = (char *) "ben3.swf"; movie->header->rate = FRAMERATE * 256; /* Right, now we need a triangle .. */ temp = swf_make_triangle(movie, &error); if (error != SWF_ENoError || temp == NULL) { fprintf(stderr,"Error getting %dth shape : %s\n", shape_num, swf_error_code_to_string(error)); exit(1); } /* Need to calloc a (raw) buffer for temp... */ if ((temp->buffer->raw = (SWF_U8 *) calloc (10240, sizeof (SWF_U8))) == NULL) { fprintf (stderr, "Calloc Fail\n"); return 1; } obj_id = swf_get_object_id(temp, &error); fprintf(stderr, "Object ID = %i\n", obj_id); swf_serialise_defineshape(temp->buffer, &error, (swf_defineshape *) temp->tag); temp->serialised = 1; // swf_add_protect(movie, &error); swf_add_setbackgroundcolour(movie, &error, 0, 255, 0, 255); swf_dump_tag(movie, &error, temp); swf_add_definebutton(movie, &error, 14, obj_id); /* Do the frames */ myname = (char *) "pigdog"; matrix->a = matrix->d = 256 * 256; matrix->b = matrix->c = 0; matrix->tx = 0 * 20; matrix->ty = 0 * 20; mycx->rb = 0; mycx->gb = 0; mycx->bb = 0; m2->a = m2->d = 2 * 256 * 256; m2->b = m2->c = 0; m2->tx = 100 * 20; m2->ty = 0 * 20; mycx->rb = 0; mycx->gb = 0; mycx->bb = 0; m3->a = m3->d = 1 * 256 * 256; m3->b = m3->c = 0; m3->tx = 100 * 20; m3->ty = 100 * 20; for (i=1; i<=NUMFRAMES; i++) { // swf_add_placeobject2(movie, &error, matrix, obj_id, i, mycx, NULL); //swf_add_placeobject2(movie, &error, m2, obj_id, 1, cx2, myname); swf_add_placeobject(movie, &error, m3, 14, 2); if (30 == i) { // swf_add_doaction(movie, &error, sactionGotoFrame); } if (2 == i) { // swf_add_doaction(movie, &error, sactionPlay); } swf_add_showframe(movie, &error); if (i < NUMFRAMES) { //swf_add_removeobject2(movie, &error, i); //swf_add_removeobject2(movie, &error, 1); swf_add_removeobject(movie, &error, 14, 2); } matrix->tx += 5 * 20; matrix->a += 4 * 256; matrix->d += 4 * 256; mycx->bb += 5; m2->ty += 2 * 20; cx2->gb += 4; } swf_add_end(movie, &error); swf_make_finalise(movie, &error); swf_free(cx2); swf_free(m3); swf_free(m2); swf_free(mycx); swf_free(matrix); swf_destroy_movie(movie); swf_destroy_parser(parser); fprintf (stderr, "OK\n"); return 0; }
static void parse_arguments(int argn, char** argv) { int i, produced = 0, skip_symbols = 0; int dump_tags = 0, dontsave = 0; int showrenames = 0; char* dump_tag_prefix = ""; for (i=1; i<argn; i++) { if (argv[i][0] == '-') { if (!strcmp(argv[i], "--help")) { show_help(); exit(0); } else if (!strcmp(argv[i], "--version") || !strcmp(argv[i], "-V")) { printf("sob version 0.2 beta Copyright (C) 2008 Kostas Michalopoulos\n"); printf("Visit http://www.badsectoracula.com/projects/sob/ for the latest version\n"); exit(0); } else if (!strcmp(argv[i], "--skip-symbols-file")) { skip_symbols = 1; if (!quiet) printf("sob: warning: skipping default symbols file\n"); } else if (!strcmp(argv[i], "--ignore-file") || !strcmp(argv[i], "-I")) { ignore_load_file(argv[++i]); } else if (!strcmp(argv[i], "--ignore") || !strcmp(argv[i], "-i")) { ignore_add(argv[++i]); } else if (!strcmp(argv[i], "--deignore") || !strcmp(argv[i], "-d")) { ignore_remove(argv[++i]); } else if (!strcmp(argv[i], "--quiet") || !strcmp(argv[i], "-q")) { quiet = 1; } else if (!strcmp(argv[i], "--output") || !strcmp(argv[i], "-o")) { outfile = argv[++i]; } else if (!strcmp(argv[i], "--dont-save")) { dontsave = 1; } else if (!strcmp(argv[i], "--show-renames")) { showrenames = 1; } else if (!strcmp(argv[i], "--obfuscate-mask")) { opt_parse_obfuscate_mask_string(argv[++i]); } else if (!strcmp(argv[i], "--dump-tags")) { dump_tags = 1; dump_tag_prefix = argv[++i]; } else { fprintf(stderr, "sob: unknown argument '%s'\n", argv[i]); } } else { char* swffile = outfile; swf_t* swf; if (!produced && !skip_symbols) { load_default_symbols(argv[0]); } produced = 1; swf = swf_read(argv[i]); if (!swf) { fprintf(stderr, "sob: failed to read swf file '%s'\n", argv[i]); exit(1); } if (!quiet) { printf("sob: processing %s swf '%s', version %i, body length %i\n", swf->compressed?"compressed":"uncompressed", swf->filename, swf->version, (int)swf->body_length); printf("sob: movie area=%i,%i -> %i,%i ", (int)(swf->rect.xmin/20), (int)(swf->rect.ymin/20), (int)(swf->rect.xmax/20), (int)(swf->rect.ymax/20)); printf("rate=%i.%i frames=%i tags=%i\n", (int)(swf->rate>>8), (int)(swf->rate&0xFF), (int)swf->frame_count, (int)swf->tag_count); } if (dump_tags) { dump_swf_tags(swf, dump_tag_prefix); swf_free(swf); exit(0); } begin_obfuscation(swf); if (showrenames) { int i; for (i=0; i<swf->renames; i++) { printf("sob: rename: '%s' => '%s'\n", swf->rename[i].old_name, swf->rename[i].new_name); } printf("sob: %i renames total\n", swf->renames); } if (!swffile) { swffile = malloc(strlen(argv[i]) + 15); sprintf(swffile, "obfuscated_%s", argv[i]); } if (!dontsave) { if (!swf_write(swf, swffile)) { fprintf(stderr, "sob: failed to write swf file '%s'\n", swffile); } else { if (!quiet) printf("sob: wrote swf file '%s' with body length %i\n", swffile, (int)swf->body_length); } } else { if (!quiet) printf("sob: pretending i wrote swf file '%s' with body length %i\n", swffile, (int)swf->body_length); } if (!outfile) free(swffile); outfile = NULL; swf_free(swf); } }