├── .gitignore ├── autodafe ├── AUTHORS ├── BUGS ├── COPYING ├── ChangeLog ├── FAQ ├── INSTALL ├── Makefile ├── Makefile.in ├── NEWS ├── README ├── TODO ├── TUTORIAL ├── autom4te.cache │ ├── output.0 │ ├── requests │ └── traces.0 ├── autoscan.log ├── boilerplate.mk ├── config.h ├── config.h.in ├── config.log ├── config.status ├── configure ├── configure.in ├── configure.scan ├── docs │ └── tutorials │ │ ├── dummy │ │ ├── Makefile │ │ ├── adbg.sh │ │ ├── autodafe.sh │ │ ├── bad-vuln2.ad │ │ ├── bad-vuln2.adc │ │ ├── binary │ │ │ └── vuln2 │ │ ├── gdb.txt │ │ ├── myvuln2.ad │ │ ├── string.txt │ │ ├── vuln2 │ │ ├── vuln2-orig.ad │ │ ├── vuln2.ad │ │ ├── vuln2.adc │ │ ├── vuln2.c │ │ ├── vuln2.o │ │ └── vuln2.pdml │ │ ├── gv-3.5.8 │ │ ├── fuzz_hello.ad │ │ ├── fuzz_hello.adc │ │ ├── gv │ │ ├── hello-orig.ps │ │ ├── hello.ad │ │ ├── hello.adc │ │ ├── hello.ps │ │ ├── hello.txt │ │ ├── txt2ad.sh │ │ └── vulnerable.txt │ │ └── html │ │ ├── autodafe.css │ │ └── index.html ├── etc │ └── generator │ │ ├── generator.sh │ │ ├── overflow │ │ └── overflow.c ├── include │ └── autodafe.h ├── src │ ├── Makefile │ ├── Makefile.in │ ├── adbg │ │ ├── 1 │ │ ├── .adbg.c.swp │ │ ├── .debug.c.swp │ │ ├── .debug.h.swp │ │ ├── .gdb.c.swp │ │ ├── Makefile │ │ ├── Makefile.in │ │ ├── adbg.c │ │ ├── conf.h │ │ ├── debug.c │ │ ├── debug.h │ │ ├── foo.txt │ │ ├── gdb.c │ │ ├── gdb.h │ │ ├── network.c │ │ ├── network.h │ │ ├── proto.h │ │ └── tags │ ├── adc │ │ ├── Makefile │ │ ├── Makefile.in │ │ ├── debug.c │ │ ├── debug.h │ │ ├── lexer.c │ │ ├── lexer.l │ │ └── parser.y │ ├── autodafe │ │ ├── Makefile │ │ ├── Makefile.in │ │ ├── autodafe.c │ │ ├── chrono.c │ │ ├── chrono.h │ │ ├── conf.h │ │ ├── dbg.c │ │ ├── dbg.h │ │ ├── debug.c │ │ ├── debug.h │ │ ├── engine.c │ │ ├── engine.h │ │ ├── file.c │ │ ├── file.h │ │ ├── fuzz.h │ │ ├── hash.c │ │ ├── hash.h │ │ ├── network.c │ │ ├── network.h │ │ ├── opcode.c │ │ ├── opcode.h │ │ ├── output.c │ │ ├── output.h │ │ ├── proto.h │ │ ├── transmit.c │ │ └── transmit.h │ ├── boilerplate.mk │ └── pdml2ad │ │ ├── Makefile │ │ ├── Makefile.in │ │ ├── conf.h │ │ ├── debug.c │ │ ├── debug.h │ │ ├── output.c │ │ ├── output.h │ │ ├── pdml2ad.c │ │ ├── recover.c │ │ ├── recover.h │ │ ├── xml.c │ │ └── xml.h ├── stamp-h1 └── tools │ ├── generator.sh │ ├── overflow │ ├── overflow.c │ └── txt2ad.sh ├── cacaphp ├── app_unix.py ├── base_app.py ├── cacaphp.py ├── config.cfg ├── fuzz_php.py ├── mangle.py ├── mangle_php.py ├── phparg.py ├── phpfuncs ├── phpfuncs.pkl ├── phpmethods ├── phpmethods.pkl ├── sqlfuzzer │ └── sql_fuzzer.py ├── timeout.py └── tools.py ├── freebsd ├── findcopyin.c ├── support.s ├── systm.h └── trap.c ├── froxy ├── TODO ├── froxy.py ├── fuzznumber.py ├── htmlfuzz.py └── mangle.py ├── fsfuzzer-0.7 ├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── TODO ├── aclocal.m4 ├── config.guess ├── config.h.in ├── config.sub ├── configure ├── configure.ac ├── depcomp ├── fsfuzz ├── fstest.c ├── install-sh ├── ltmain.sh ├── mangle.c ├── missing ├── run_last └── run_test ├── fusil ├── AUTHORS ├── COPYING ├── ChangeLog ├── IDEAS ├── INSTALL ├── README ├── README.windows.txt ├── TODO ├── conv_python3.0.sh ├── doc │ ├── Makefile │ ├── agent.rst │ ├── architecture.rst │ ├── c_tools.rst │ ├── configuration.rst │ ├── events.rst │ ├── file_watch.rst │ ├── howto_write_fuzzer.rst │ ├── index.rst │ ├── linux_process_limits.rst │ ├── mangle.rst │ ├── mas.rst │ ├── network.rst │ ├── process.rst │ ├── safety.rst │ ├── score.rst │ ├── time.rst │ └── usage.rst ├── dtds │ ├── HTMLlat1.ent │ ├── loose.dtd │ ├── protos │ ├── svg10.dtd │ ├── svg11-flat.dtd │ ├── xhtml-lat1.ent │ ├── xhtml-special.ent │ ├── xhtml-symbol.ent │ ├── xhtml1-strict.dtd │ ├── xhtml1-transitional.dtd │ └── xhtml11.dtd ├── examples │ ├── good-bye-world │ ├── hello-world │ └── xterm ├── fusil │ ├── .c_tools.py.swp │ ├── __init__.py │ ├── aggressivity.py │ ├── application.py │ ├── application_logger.py │ ├── auto_mangle.py │ ├── bits.py │ ├── bytes_generator.py │ ├── c_tools.py │ ├── cmd_help_parser.py │ ├── config.py │ ├── directory.py │ ├── dummy_mangle.py │ ├── error.py │ ├── file_tools.py │ ├── file_watch.py │ ├── fixpng.py │ ├── fuzz.py │ ├── incr_mangle.py │ ├── incr_mangle_op.py │ ├── linux │ │ ├── __init__.py │ │ ├── cpu_load.py │ │ └── syslog.py │ ├── mangle.py │ ├── mangle_agent.py │ ├── mangle_op.py │ ├── mas │ │ ├── __init__.py │ │ ├── agent.py │ │ ├── agent_id.py │ │ ├── agent_list.py │ │ ├── application_agent.py │ │ ├── mailbox.py │ │ ├── message.py │ │ ├── mta.py │ │ └── univers.py │ ├── mockup.py │ ├── network │ │ ├── __init__.py │ │ ├── client.py │ │ ├── http_request.py │ │ ├── http_server.py │ │ ├── server.py │ │ ├── server_client.py │ │ ├── tcp_client.py │ │ ├── tcp_server.py │ │ ├── tools.py │ │ └── unix_client.py │ ├── process │ │ ├── __init__.py │ │ ├── attach.py │ │ ├── cmdline.py │ │ ├── cpu_probe.py │ │ ├── create.py │ │ ├── debugger.py │ │ ├── env.py │ │ ├── mangle.py │ │ ├── prepare.py │ │ ├── replay_python.py │ │ ├── stdout.py │ │ ├── time_watch.py │ │ ├── tools.py │ │ └── watch.py │ ├── project.py │ ├── project_agent.py │ ├── project_directory.py │ ├── python_tools.py │ ├── score.py │ ├── session.py │ ├── session_agent.py │ ├── session_directory.py │ ├── svggen.py │ ├── system_calm.py │ ├── terminal_echo.py │ ├── time_watch.py │ ├── tools.py │ ├── unicode_generator.py │ ├── unsafe.py │ ├── version.py │ ├── write_code.py │ ├── x11.py │ ├── xhost.py │ ├── xmlgen.py │ └── zzuf.py ├── fuzzers │ ├── fusil-clamav │ ├── fusil-feh │ ├── fusil-firefox │ ├── fusil-gettext │ ├── fusil-gimp │ ├── fusil-gstreamer │ ├── fusil-imagemagick │ ├── fusil-libc-printf │ ├── fusil-mp4dump │ ├── fusil-mplayer │ ├── fusil-ogg123 │ ├── fusil-php │ ├── fusil-poppler │ ├── fusil-python │ ├── fusil-vlc │ ├── fusil-wizzard │ ├── fusil-zzuf │ └── notworking │ │ ├── .fusil-linux-sopt.swp │ │ ├── fusil-apache │ │ ├── fusil-libc-env │ │ ├── fusil-libexif │ │ ├── fusil-linux-ioctl │ │ ├── fusil-linux-proc │ │ ├── fusil-linux-sopt │ │ ├── fusil-linux-syscall │ │ ├── fusil-mysql │ │ └── fusil-rpm ├── graph.sh ├── local.sh ├── lsall.sh ├── ptrace │ ├── AUTHORS │ ├── COPYING │ ├── ChangeLog │ ├── INSTALL │ ├── README │ ├── README.cptrace │ ├── TODO │ ├── conv_python3.0.sh │ ├── cptrace │ │ ├── Makefile │ │ ├── cptrace.c │ │ └── version.py │ ├── doc │ │ ├── process_events.rst │ │ └── ptrace_signal.rst │ ├── examples │ │ ├── itrace.py │ │ └── simple_dbg.py │ ├── gdb.py │ ├── ptrace │ │ ├── __init__.py │ │ ├── binding │ │ │ ├── __init__.py │ │ │ ├── cpu.py │ │ │ ├── freebsd_struct.py │ │ │ ├── func.py │ │ │ ├── linux_struct.py │ │ │ └── openbsd_struct.py │ │ ├── compatibility.py │ │ ├── cpu_info.py │ │ ├── ctypes_errno.py │ │ ├── ctypes_libc.py │ │ ├── ctypes_stdint.py │ │ ├── ctypes_tools.py │ │ ├── debugger │ │ │ ├── __init__.py │ │ │ ├── application.py │ │ │ ├── backtrace.py │ │ │ ├── breakpoint.py │ │ │ ├── child.py │ │ │ ├── debugger.py │ │ │ ├── memory_mapping.py │ │ │ ├── parse_expr.py │ │ │ ├── process.py │ │ │ ├── process_error.py │ │ │ ├── process_event.py │ │ │ ├── ptrace_signal.py │ │ │ ├── signal_reason.py │ │ │ └── syscall_state.py │ │ ├── disasm.py │ │ ├── error.py │ │ ├── func_arg.py │ │ ├── func_call.py │ │ ├── linux_proc.py │ │ ├── logging_tools.py │ │ ├── mockup.py │ │ ├── os_tools.py │ │ ├── process_tools.py │ │ ├── profiler.py │ │ ├── pydistorm.py │ │ ├── signames.py │ │ ├── syscall │ │ │ ├── __init__.py │ │ │ ├── freebsd_constants.py │ │ │ ├── freebsd_syscall.py │ │ │ ├── linux_constants.py │ │ │ ├── linux_struct.py │ │ │ ├── linux_syscall32.py │ │ │ ├── linux_syscall64.py │ │ │ ├── names.py │ │ │ ├── posix_arg.py │ │ │ ├── posix_constants.py │ │ │ ├── prototypes.py │ │ │ ├── ptrace_syscall.py │ │ │ ├── socketcall.py │ │ │ ├── socketcall_constants.py │ │ │ ├── socketcall_struct.py │ │ │ └── syscall_argument.py │ │ ├── terminal.py │ │ ├── tools.py │ │ └── version.py │ ├── pyflakes.sh │ ├── python3.0.patch │ ├── setup.py │ ├── setup_cptrace.py │ ├── strace.py │ ├── test_doc.py │ └── tests │ │ └── crash │ │ ├── BSDmakefile │ │ ├── Makefile │ │ ├── abort.c │ │ ├── call_null.c │ │ ├── div_zero.c │ │ ├── execve.c │ │ ├── fork.c │ │ ├── invalid_read.c │ │ ├── invalid_write.c │ │ ├── pthread.c │ │ ├── socket_ipv4_tcp.c │ │ └── stack_overflow.c ├── py3k_snapshot.py ├── pyflakes.sh ├── python3.0.patch ├── setup.py ├── test_doc.py └── tests │ ├── cmd_help │ ├── gcc.help │ ├── identify.help │ ├── ls.help │ ├── ping.help │ └── python.help │ ├── cmd_help_parser.rst │ ├── file_watch_ignore.rst │ └── file_watch_read.rst ├── hachoir ├── README ├── benchmark.sh ├── bitarray │ ├── AUTHORS │ ├── CHANGE_LOG │ ├── LICENSE │ ├── MANIFEST │ ├── PKG-INFO │ ├── README │ ├── TODO │ ├── bitarray │ │ ├── __init__.py │ │ ├── _bitarray.c │ │ └── test_bitarray.py │ ├── build │ │ ├── lib.linux-x86_64-2.7 │ │ │ └── bitarray │ │ │ │ ├── __init__.py │ │ │ │ ├── _bitarray.so │ │ │ │ └── test_bitarray.py │ │ └── temp.linux-x86_64-2.7 │ │ │ └── bitarray │ │ │ └── _bitarray.o │ ├── examples │ │ ├── README │ │ ├── decoding.py │ │ ├── huffman.py │ │ ├── mandel.py │ │ ├── ndarray.py │ │ ├── pbm.py │ │ └── smallints.py │ └── setup.py ├── coverage_test.py ├── coverage_test.sh ├── hachoir-core │ ├── AUTHORS │ ├── COPYING │ ├── ChangeLog │ ├── MANIFEST.in │ ├── README │ ├── doc │ │ ├── adding_fields.graphviz │ │ ├── default.css │ │ ├── hachoir-api.rst │ │ ├── internals.rst │ │ ├── rest.css │ │ ├── uml.xmi │ │ ├── uml_field.dia │ │ └── uml_field_set.dia │ ├── hachoir_core │ │ ├── __init__.py │ │ ├── benchmark.py │ │ ├── bits.py │ │ ├── cmd_line.py │ │ ├── compatibility.py │ │ ├── config.py │ │ ├── dict.py │ │ ├── endian.py │ │ ├── error.py │ │ ├── event_handler.py │ │ ├── field │ │ │ ├── __init__.py │ │ │ ├── basic_field_set.py │ │ │ ├── bit_field.py │ │ │ ├── byte_field.py │ │ │ ├── character.py │ │ │ ├── enum.py │ │ │ ├── fake_array.py │ │ │ ├── field.py │ │ │ ├── field_set.py │ │ │ ├── float.py │ │ │ ├── generic_field_set.py │ │ │ ├── helper.py │ │ │ ├── integer.py │ │ │ ├── link.py │ │ │ ├── new_seekable_field_set.py │ │ │ ├── padding.py │ │ │ ├── parser.py │ │ │ ├── seekable_field_set.py │ │ │ ├── static_field_set.py │ │ │ ├── string_field.py │ │ │ ├── sub_file.py │ │ │ ├── timestamp.py │ │ │ └── vector.py │ │ ├── i18n.py │ │ ├── iso639.py │ │ ├── language.py │ │ ├── log.py │ │ ├── memory.py │ │ ├── profiler.py │ │ ├── stream │ │ │ ├── __init__.py │ │ │ ├── input.py │ │ │ ├── input_helper.py │ │ │ ├── output.py │ │ │ └── stream.py │ │ ├── text_handler.py │ │ ├── timeout.py │ │ ├── tools.py │ │ └── version.py │ ├── setup.py │ └── test_doc.py ├── hachoir-editor │ ├── AUTHORS │ ├── COPYING │ ├── README │ └── hachoir_editor │ │ ├── __init__.py │ │ ├── field.py │ │ ├── fieldset.py │ │ └── typed_field.py ├── hachoir-gtk │ ├── AUTHORS │ ├── hachoir-gtk │ └── hachoir.glade ├── hachoir-http │ ├── AUTHORS │ ├── COPYING │ ├── README │ ├── cgi-bin │ │ └── hachoir.py │ ├── hachoir-client.js │ └── hachoir-style.css ├── hachoir-metadata │ ├── AUTHORS │ ├── COPYING │ ├── ChangeLog │ ├── INSTALL │ ├── MANIFEST.in │ ├── README │ ├── gnome │ │ ├── README │ │ └── hachoir │ ├── hachoir-metadata │ ├── hachoir-metadata-gtk │ ├── hachoir-metadata-qt │ ├── hachoir_metadata │ │ ├── __init__.py │ │ ├── archive.py │ │ ├── audio.py │ │ ├── config.py │ │ ├── file_system.py │ │ ├── filter.py │ │ ├── formatter.py │ │ ├── image.py │ │ ├── jpeg.py │ │ ├── metadata.py │ │ ├── metadata_item.py │ │ ├── misc.py │ │ ├── program.py │ │ ├── qt │ │ │ ├── __init__.py │ │ │ └── dialog.ui │ │ ├── register.py │ │ ├── riff.py │ │ ├── safe.py │ │ ├── setter.py │ │ ├── timezone.py │ │ ├── version.py │ │ └── video.py │ ├── kde │ │ ├── README │ │ ├── hachoir-metadata-kde │ │ └── hachoir.desktop │ ├── metadata_csv.py │ ├── run_testcase.py │ ├── setup.py │ └── test_doc.py ├── hachoir-parser │ ├── AUTHORS │ ├── COPYING │ ├── ChangeLog │ ├── INSTALL │ ├── MANIFEST.in │ ├── README.header │ ├── README.py │ ├── hachoir_parser │ │ ├── __init__.py │ │ ├── archive │ │ │ ├── __init__.py │ │ │ ├── ace.py │ │ │ ├── ar.py │ │ │ ├── bzip2_parser.py │ │ │ ├── cab.py │ │ │ ├── gzip_parser.py │ │ │ ├── lzx.py │ │ │ ├── mar.py │ │ │ ├── mozilla_ar.py │ │ │ ├── rar.py │ │ │ ├── rpm.py │ │ │ ├── sevenzip.py │ │ │ ├── tar.py │ │ │ ├── zip.py │ │ │ └── zlib.py │ │ ├── audio │ │ │ ├── __init__.py │ │ │ ├── aiff.py │ │ │ ├── au.py │ │ │ ├── flac.py │ │ │ ├── id3.py │ │ │ ├── itunesdb.py │ │ │ ├── midi.py │ │ │ ├── mod.py │ │ │ ├── modplug.py │ │ │ ├── mpeg_audio.py │ │ │ ├── real_audio.py │ │ │ ├── s3m.py │ │ │ └── xm.py │ │ ├── common │ │ │ ├── __init__.py │ │ │ ├── deflate.py │ │ │ ├── msdos.py │ │ │ ├── tracker.py │ │ │ ├── win32.py │ │ │ └── win32_lang_id.py │ │ ├── container │ │ │ ├── __init__.py │ │ │ ├── action_script.py │ │ │ ├── asn1.py │ │ │ ├── mkv.py │ │ │ ├── ogg.py │ │ │ ├── realmedia.py │ │ │ ├── riff.py │ │ │ └── swf.py │ │ ├── file_system │ │ │ ├── __init__.py │ │ │ ├── ext2.py │ │ │ ├── fat.py │ │ │ ├── iso9660.py │ │ │ ├── linux_swap.py │ │ │ ├── mbr.py │ │ │ ├── ntfs.py │ │ │ └── reiser_fs.py │ │ ├── game │ │ │ ├── __init__.py │ │ │ ├── blp.py │ │ │ ├── laf.py │ │ │ ├── spider_man_video.py │ │ │ └── zsnes.py │ │ ├── guess.py │ │ ├── image │ │ │ ├── __init__.py │ │ │ ├── bmp.py │ │ │ ├── common.py │ │ │ ├── exif.py │ │ │ ├── gif.py │ │ │ ├── ico.py │ │ │ ├── iptc.py │ │ │ ├── jpeg.py │ │ │ ├── pcx.py │ │ │ ├── photoshop_metadata.py │ │ │ ├── png.py │ │ │ ├── psd.py │ │ │ ├── tga.py │ │ │ ├── tiff.py │ │ │ ├── wmf.py │ │ │ └── xcf.py │ │ ├── misc │ │ │ ├── __init__.py │ │ │ ├── bplist.py │ │ │ ├── chm.py │ │ │ ├── common.py │ │ │ ├── dsstore.py │ │ │ ├── file_3do.py │ │ │ ├── file_3ds.py │ │ │ ├── gnome_keyring.py │ │ │ ├── hlp.py │ │ │ ├── lnk.py │ │ │ ├── msoffice.py │ │ │ ├── msoffice_summary.py │ │ │ ├── mstask.py │ │ │ ├── ole2.py │ │ │ ├── ole2_util.py │ │ │ ├── pcf.py │ │ │ ├── pdf.py │ │ │ ├── pifv.py │ │ │ ├── torrent.py │ │ │ ├── ttf.py │ │ │ ├── word_2.py │ │ │ └── word_doc.py │ │ ├── network │ │ │ ├── __init__.py │ │ │ ├── common.py │ │ │ ├── ouid.py │ │ │ └── tcpdump.py │ │ ├── parser.py │ │ ├── parser_list.py │ │ ├── program │ │ │ ├── __init__.py │ │ │ ├── elf.py │ │ │ ├── exe.py │ │ │ ├── exe_ne.py │ │ │ ├── exe_pe.py │ │ │ ├── exe_res.py │ │ │ ├── java.py │ │ │ ├── prc.py │ │ │ └── python.py │ │ ├── template.py │ │ ├── version.py │ │ └── video │ │ │ ├── __init__.py │ │ │ ├── amf.py │ │ │ ├── asf.py │ │ │ ├── flv.py │ │ │ ├── fourcc.py │ │ │ ├── mov.py │ │ │ ├── mpeg_ts.py │ │ │ └── mpeg_video.py │ ├── setup.py │ └── tests │ │ ├── download_testcase.py │ │ └── run_testcase.py ├── hachoir-regex │ ├── AUTHORS │ ├── COPYING │ ├── INSTALL │ ├── MANIFEST.in │ ├── README │ ├── hachoir_regex │ │ ├── __init__.py │ │ ├── compatibility.py │ │ ├── parser.py │ │ ├── pattern.py │ │ ├── regex.py │ │ ├── tools.py │ │ └── version.py │ ├── regex.rst │ ├── regression.rst │ ├── setup.py │ └── test_doc.py ├── hachoir-subfile │ ├── AUTHORS │ ├── COPYING │ ├── README │ ├── hachoir-subfile │ ├── hachoir_subfile │ │ ├── __init__.py │ │ ├── data_rate.py │ │ ├── output.py │ │ ├── pattern.py │ │ ├── search.py │ │ └── version.py │ └── setup.py ├── hachoir-tools │ ├── AUTHORS │ ├── COPYING │ ├── README.hachoir-grep │ ├── README.hachoir-strip │ ├── app_unix.py │ ├── base_app.py │ ├── cmdcrash.py │ ├── download_random │ │ ├── sort_by_filext.sh │ │ └── webgobbler │ │ │ ├── main.py │ │ │ └── webgobbler.py │ ├── entropy.py │ ├── find_deflate.py │ ├── fuzzer.py │ ├── fuzzer │ │ ├── error │ │ │ ├── exception-04dc6a047cb099bc1b1c532f50e228441d801218-ok.zip │ │ │ ├── exception-0dba4144634e5254cce16e1ee3ea0867eefe6586-ok.zip │ │ │ ├── exception-133a887861ea8222c08bf55343c015ced27f5538-ok.zip │ │ │ ├── exception-14a8f0f3069f85d01d34dd3e85fa262eb410b25b-ok.zip │ │ │ ├── exception-1adf3c0ef3fb9bb2cfcc657837761725ae70fe4c-ok.zip │ │ │ ├── exception-2318e1767ef3b1ea60cd63b6730b401bef735964-ok.zip │ │ │ ├── exception-289ba035198c090177cedc1326731c099315f5fd-ok.zip │ │ │ ├── exception-3a3dd3881b729b5cdde6f19ee2340d01583c5276-ok.zip │ │ │ ├── exception-3cc7a2d89c990d65b4518c07fd632ed5fb844d25-ok.zip │ │ │ ├── exception-41540bda885d32d8aef5b4dd5cca80f6e8e69f37-ok.zip │ │ │ ├── exception-4819e08fb723c299fe9ec7c92c89548c9236a0fd-ok.zip │ │ │ ├── exception-4f8aab01747e6024c735bba6f5ed1f5d0c0bec74-ok.zip │ │ │ ├── exception-5073d41e77cd82d66399ec6270ade46052010516-ok.zip │ │ │ ├── exception-5102918635e3d2fd7e2d1a288d5ed6e1024ca595-ok.zip │ │ │ ├── exception-5d004a2b45b6edd62e3ae41e7d1e3b204894ee49-ok.zip │ │ │ ├── exception-7a37693ecbac429c67d2dda37cf5aff2dad11d4f-ok.zip │ │ │ ├── exception-7cba1f6eb7aa3298248eddd931ac27bfacc2101e-ok.zip │ │ │ ├── exception-7d2acdd7acc9367d2ef6b676828e42eb2116133a-ok.zip │ │ │ ├── exception-7e197938365e9cd839655de7cbcaed820fc9fc67-ok.zip │ │ │ ├── exception-7f320946f63c9bef713e947e57629af92e16b90a-ok.zip │ │ │ ├── exception-873e96329e8f5019d2ddb22878a8b4d6ba0d17b9-ok.zip │ │ │ ├── exception-9ab8ab9d7430f52c4ccb1229e7e6f3310919c497-ok.zip │ │ │ ├── exception-a0584e072e1489f203ed67c8ce5b73aef3b89f09-ok.zip │ │ │ ├── exception-a45958bf4cf0e7b50872a1155e5310b8b632d72f-ok.zip │ │ │ ├── exception-a5a901d7e1b3106ad257acd2c48c44f2b2ca7c16-ok.zip │ │ │ ├── exception-a910dd1e22ad869a46b225a6f9c78a7afeb2ea7c-ok.zip │ │ │ ├── exception-ae372df44a368be67aa92fe676bcf9a3932fc3da-ok.zip │ │ │ ├── exception-bd12fba1309885b318ee6fb25ecb9d751893b7de-ok.zip │ │ │ ├── exception-dc689ef86fddb358e8bc0026ccf1c700d3eb5071-ok.zip │ │ │ ├── exception-e1c73f42c3979b00e3965faa4e3002e42ae921c5-ok.zip │ │ │ ├── exception-ed2b64656b0b4dfc1a3ed6ea15743cac7982dab3-ok.zip │ │ │ ├── exception-f026d89e2125d60153b680416a2a85f2102e30b4-ok.zip │ │ │ └── exception-f16619b350b11d03a2b36dbe9273e9cd164d2ade-ok.zip │ │ ├── file_fuzzer.py │ │ ├── mangle.py │ │ ├── stress.py │ │ ├── tools.py │ │ └── zip │ │ │ └── ok.zip │ ├── hachoir-fuse.py │ ├── hachoir-grep │ ├── hachoir-strip │ ├── package.sh │ ├── steganography.py │ └── swf_extractor.py ├── hachoir-urwid │ ├── AUTHORS │ ├── COPYING │ ├── README │ ├── hachoir-urwid │ ├── hachoir_urwid │ │ ├── __init__.py │ │ ├── urwid_ui.py │ │ └── version.py │ └── setup.py ├── hachoir-wx │ ├── AUTHORS │ ├── BUGS │ ├── COPYING │ ├── ChangeLog │ ├── README │ ├── hachoir-wx │ ├── hachoir_wx │ │ ├── __init__.py │ │ ├── app.py │ │ ├── dialogs.py │ │ ├── dispatcher.py │ │ ├── field_view │ │ │ ├── __init__.py │ │ │ ├── core_type_menu.py │ │ │ ├── core_type_menu_fwd.py │ │ │ ├── core_type_menu_imp.py │ │ │ ├── field_menu.py │ │ │ ├── field_menu_fwd.py │ │ │ ├── field_menu_imp.py │ │ │ ├── field_menu_setup.py │ │ │ ├── field_split_menu.py │ │ │ ├── field_split_menu_fwd.py │ │ │ ├── field_split_menu_imp.py │ │ │ ├── field_view.py │ │ │ ├── field_view_fwd.py │ │ │ ├── field_view_imp.py │ │ │ ├── field_view_setup.py │ │ │ ├── format.py │ │ │ ├── mutator.py │ │ │ └── stubs.py │ │ ├── frame_view │ │ │ ├── __init__.py │ │ │ ├── frame_view.py │ │ │ ├── frame_view_fwd.py │ │ │ ├── frame_view_imp.py │ │ │ └── frame_view_setup.py │ │ ├── hex_view │ │ │ ├── __init__.py │ │ │ ├── compat_all.py │ │ │ ├── compat_gtk.py │ │ │ ├── compat_msw.py │ │ │ ├── hex_view.py │ │ │ ├── hex_view_fwd.py │ │ │ ├── hex_view_imp.py │ │ │ ├── hex_view_scroll.py │ │ │ ├── hex_view_scroll_fwd.py │ │ │ ├── hex_view_scroll_imp.py │ │ │ ├── hex_view_scroll_setup.py │ │ │ ├── hex_view_setup.py │ │ │ └── stubs.py │ │ ├── resource │ │ │ ├── __init__.py │ │ │ ├── hachoir_wx.xrc │ │ │ └── resource.py │ │ ├── unicode.py │ │ └── version.py │ └── setup.py ├── setupenv.sh ├── snapshot.sh ├── test_code.sh └── test_code_snapshot.sh ├── htmler ├── dtds │ ├── HTMLlat1.ent │ ├── loose.dtd │ ├── protos │ ├── svg10.dtd │ ├── svg11-flat.dtd │ ├── xhtml-lat1.ent │ ├── xhtml-special.ent │ ├── xhtml-symbol.ent │ ├── xhtml1-strict.dtd │ ├── xhtml1-transitional.dtd │ └── xhtml11.dtd ├── fuzzer.py ├── htmler.py └── parsedtd.py ├── jsfunfuzz ├── .DS_Store ├── about.txt ├── jsfunfuzz.html ├── jsfunfuzz.js ├── multi_timed_run.py └── using.txt ├── kernfuzz ├── Makefile ├── freebsd.c └── kfuzz.c ├── kernusse ├── Makefile └── netusse.c ├── pycapreplay ├── dpkt │ ├── .svn │ │ ├── entries │ │ ├── format │ │ └── wc.db │ ├── AUTHORS │ ├── CHANGES │ ├── HACKING │ ├── LICENSE │ ├── Makefile │ ├── README │ ├── build │ │ └── lib │ │ │ └── dpkt │ │ │ ├── __init__.py │ │ │ ├── ah.py │ │ │ ├── aim.py │ │ │ ├── arp.py │ │ │ ├── asn1.py │ │ │ ├── bgp.py │ │ │ ├── cdp.py │ │ │ ├── crc32c.py │ │ │ ├── dhcp.py │ │ │ ├── diameter.py │ │ │ ├── dns.py │ │ │ ├── dpkt.py │ │ │ ├── dtp.py │ │ │ ├── esp.py │ │ │ ├── ethernet.py │ │ │ ├── gre.py │ │ │ ├── gzip.py │ │ │ ├── h225.py │ │ │ ├── hsrp.py │ │ │ ├── http.py │ │ │ ├── icmp.py │ │ │ ├── icmp6.py │ │ │ ├── ieee80211.py │ │ │ ├── igmp.py │ │ │ ├── ip.py │ │ │ ├── ip6.py │ │ │ ├── ipx.py │ │ │ ├── llc.py │ │ │ ├── loopback.py │ │ │ ├── mrt.py │ │ │ ├── netbios.py │ │ │ ├── netflow.py │ │ │ ├── ntp.py │ │ │ ├── ospf.py │ │ │ ├── pcap.py │ │ │ ├── pim.py │ │ │ ├── pmap.py │ │ │ ├── ppp.py │ │ │ ├── pppoe.py │ │ │ ├── qq.py │ │ │ ├── radiotap.py │ │ │ ├── radius.py │ │ │ ├── rfb.py │ │ │ ├── rip.py │ │ │ ├── rpc.py │ │ │ ├── rtp.py │ │ │ ├── rx.py │ │ │ ├── sccp.py │ │ │ ├── sctp.py │ │ │ ├── sip.py │ │ │ ├── sll.py │ │ │ ├── smb.py │ │ │ ├── snoop.py │ │ │ ├── ssl.py │ │ │ ├── stp.py │ │ │ ├── stun.py │ │ │ ├── tcp.py │ │ │ ├── telnet.py │ │ │ ├── tftp.py │ │ │ ├── tns.py │ │ │ ├── tpkt.py │ │ │ ├── udp.py │ │ │ ├── vrrp.py │ │ │ └── yahoo.py │ ├── dpkt │ │ ├── __init__.py │ │ ├── ah.py │ │ ├── aim.py │ │ ├── arp.py │ │ ├── asn1.py │ │ ├── bgp.py │ │ ├── cdp.py │ │ ├── crc32c.py │ │ ├── dhcp.py │ │ ├── diameter.py │ │ ├── dns.py │ │ ├── dpkt.py │ │ ├── dtp.py │ │ ├── esp.py │ │ ├── ethernet.py │ │ ├── gre.py │ │ ├── gzip.py │ │ ├── h225.py │ │ ├── hsrp.py │ │ ├── http.py │ │ ├── icmp.py │ │ ├── icmp6.py │ │ ├── ieee80211.py │ │ ├── igmp.py │ │ ├── ip.py │ │ ├── ip6.py │ │ ├── ipx.py │ │ ├── llc.py │ │ ├── loopback.py │ │ ├── mrt.py │ │ ├── netbios.py │ │ ├── netflow.py │ │ ├── ntp.py │ │ ├── ospf.py │ │ ├── pcap.py │ │ ├── pim.py │ │ ├── pmap.py │ │ ├── ppp.py │ │ ├── pppoe.py │ │ ├── qq.py │ │ ├── radiotap.py │ │ ├── radius.py │ │ ├── rfb.py │ │ ├── rip.py │ │ ├── rpc.py │ │ ├── rtp.py │ │ ├── rx.py │ │ ├── sccp.py │ │ ├── sctp.py │ │ ├── sip.py │ │ ├── sll.py │ │ ├── smb.py │ │ ├── snoop.py │ │ ├── ssl.py │ │ ├── stp.py │ │ ├── stun.py │ │ ├── tcp.py │ │ ├── telnet.py │ │ ├── tftp.py │ │ ├── tns.py │ │ ├── tpkt.py │ │ ├── udp.py │ │ ├── vrrp.py │ │ └── yahoo.py │ ├── examples │ │ ├── dhcprequest.py │ │ ├── dnsping.py │ │ ├── nbtping.py │ │ └── ping.py │ ├── setup.py │ └── tests │ │ ├── test-perf.py │ │ └── test-perf2.py ├── pypcap │ ├── .svn │ │ ├── entries │ │ ├── format │ │ └── wc.db │ ├── AUTHORS │ ├── CHANGES │ ├── INSTALL │ ├── LICENSE │ ├── Makefile │ ├── README │ ├── build │ │ ├── lib.linux-x86_64-2.7 │ │ │ └── pcap.so │ │ └── temp.linux-x86_64-2.7 │ │ │ ├── pcap.o │ │ │ └── pcap_ex.o │ ├── config.h │ ├── config.pkl │ ├── pcap.c │ ├── pcap.pyx │ ├── pcap_ex.c │ ├── pcap_ex.h │ ├── setup.py │ ├── test.pcap │ ├── test.py │ └── testsniff.py ├── replay.py ├── setup.sh └── telnet.pcap ├── untidy ├── LICENSE ├── README ├── bsfuzzer.py ├── fuzzingFunctions.py └── untidy.py └── xmlgen ├── fuzz.py └── svg11-flat.dtd /.gitignore: -------------------------------------------------------------------------------- 1 | # Use wildcards as well 2 | *~ 3 | *.swp 4 | php-* 5 | *.php 6 | *.pyc 7 | *.phpt 8 | apps/* 9 | *.html 10 | *svn-* 11 | *.log 12 | *.dat 13 | -------------------------------------------------------------------------------- /autodafe/AUTHORS: -------------------------------------------------------------------------------- 1 | Martin Vuagnoux 2 | -------------------------------------------------------------------------------- /autodafe/BUGS: -------------------------------------------------------------------------------- 1 | * 2004-09-25 Martin Vuagnoux - pdml2ad 2 | Some strings are not recognized (separated if there is only 3 | a \x0a (^M). 4 | 5 | 6 | * 2004-09-25 Martin Vuagnoux - autodafe 7 | If string(""); memory leak (two free are missing). 8 | 9 | 10 | * 2004-09-25 Martin Vuagnoux - adbg 11 | the arguments with "-a" are interpreted by getopt. 12 | 13 | WORKAROUND: Launch the targeted software program independently 14 | and attach to process with its PID. 15 | 16 | 17 | * 2004-09-28 Martin Vuagnoux - adbg 18 | there is two times "check the string" with the example 19 | of ghostview... check why. 20 | 21 | * 2004-10-06 Martin Vuagnoux - autodafe 22 | The block_size_(dec/hex)_string computation has a bug. Functions 23 | are removed. 24 | -------------------------------------------------------------------------------- /autodafe/ChangeLog: -------------------------------------------------------------------------------- 1 | 2006-08-04 Martin Vuagnoux 2 | 3 | * autodafe: first public beta release (version 0.1). 4 | 5 | -------------------------------------------------------------------------------- /autodafe/FAQ: -------------------------------------------------------------------------------- 1 | 1. General Questions 2 | ========================================================================== 3 | 1.1 4 | 5 | 6 | 2. Compilation/Installation 7 | ========================================================================== 8 | 2.1-[?] The configure says: error: gdb needed. 9 | [!] You need to have gdb >= 6.2 to compile le debugger/tracer adbg. 10 | 11 | 2.2-[?] I tried to compile (make) but it doesn't work! 12 | [!] You probably have a gcc version older than 3.3.4. This tool uses 13 | new functionalities from gcc. So you need to uprgrade your gcc. 14 | 15 | 2.3-[?] 16 | [!] 17 | -------------------------------------------------------------------------------- /autodafe/INSTALL: -------------------------------------------------------------------------------- 1 | SEE README -------------------------------------------------------------------------------- /autodafe/Makefile: -------------------------------------------------------------------------------- 1 | SUBDIRS = src 2 | 3 | all:: 4 | 5 | install:: 6 | cd ./etc/generator; ./generator.sh /usr/local/etc 7 | 8 | clean:: 9 | rm -rf ./etc/generator/autodafe/* 10 | 11 | #followed by boilerplate.mk 12 | 13 | all:: 14 | @subdirs="$(SUBDIRS)"; for d in $$subdirs; do (cd $$d; $(MAKE) $@) || exit 1; done 15 | 16 | clean:: 17 | @subdirs="$(SUBDIRS)"; for d in $$subdirs; do (cd $$d; $(MAKE) $@) || exit 1; done 18 | 19 | install:: 20 | @subdirs="$(SUBDIRS)"; for d in $$subdirs; do (cd $$d; $(MAKE) $@) || exit 1; done 21 | 22 | uninstall:: 23 | @subdirs="$(SUBDIRS)"; for d in $$subdirs; do (cd $$d; $(MAKE) $@) || exit 1; done 24 | 25 | 26 | SHELL = /bin/sh 27 | top_srcdir = . 28 | -------------------------------------------------------------------------------- /autodafe/Makefile.in: -------------------------------------------------------------------------------- 1 | SUBDIRS = src 2 | 3 | all:: 4 | 5 | install:: 6 | cd ./etc/generator; ./generator.sh /usr/local/etc 7 | 8 | clean:: 9 | rm -rf ./etc/generator/autodafe/* 10 | 11 | #followed by boilerplate.mk 12 | -------------------------------------------------------------------------------- /autodafe/NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/autodafe/NEWS -------------------------------------------------------------------------------- /autodafe/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/autodafe/README -------------------------------------------------------------------------------- /autodafe/TODO: -------------------------------------------------------------------------------- 1 | * do the man pages for autodafe, abdg, adc and pdml2ad. 2 | 3 | * add the adbg windows version to the project. 4 | 5 | * add the format and double free detection to the public version. 6 | -------------------------------------------------------------------------------- /autodafe/TUTORIAL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/autodafe/TUTORIAL -------------------------------------------------------------------------------- /autodafe/autoscan.log: -------------------------------------------------------------------------------- 1 | autoscan: warning: missing AC_PROG_AWK wanted by: 2 | tools/txt2ad.sh:27 3 | -------------------------------------------------------------------------------- /autodafe/boilerplate.mk: -------------------------------------------------------------------------------- 1 | 2 | all:: 3 | @subdirs="$(SUBDIRS)"; for d in $$subdirs; do (cd $$d; $(MAKE) $@) || exit 1; done 4 | 5 | clean:: 6 | @subdirs="$(SUBDIRS)"; for d in $$subdirs; do (cd $$d; $(MAKE) $@) || exit 1; done 7 | 8 | install:: 9 | @subdirs="$(SUBDIRS)"; for d in $$subdirs; do (cd $$d; $(MAKE) $@) || exit 1; done 10 | 11 | uninstall:: 12 | @subdirs="$(SUBDIRS)"; for d in $$subdirs; do (cd $$d; $(MAKE) $@) || exit 1; done 13 | 14 | 15 | SHELL = @SHELL@ 16 | top_srcdir = @top_srcdir@ 17 | -------------------------------------------------------------------------------- /autodafe/docs/tutorials/dummy/Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | CFLAGS = -Wall 3 | LIBS = 4 | INCLUDES= 5 | OBJ = vuln2.o 6 | 7 | all: vuln2 8 | 9 | vuln2: $(OBJ) 10 | $(CC) $(CFLAGS) $^ $(LIBS) -o $@ 11 | 12 | clean: 13 | rm *.o vuln2 14 | -------------------------------------------------------------------------------- /autodafe/docs/tutorials/dummy/adbg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | adbg -v -p 31337 ./vuln2 2000 3 | 4 | 5 | -------------------------------------------------------------------------------- /autodafe/docs/tutorials/dummy/autodafe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | autodafe -b -vv -p 2000 -r localhost -P 31337 -D localhost ./vuln2.adc 3 | 4 | -------------------------------------------------------------------------------- /autodafe/docs/tutorials/dummy/bad-vuln2.ad: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------* 2 | * xml autodafe's parser v.0.1 (c) Martin Vuagnoux - 2004 * 3 | * auto-generated script using PDML (Packet Details Markup Language) source * 4 | *--------------------------------------------------------------------------*/ 5 | 6 | block_begin("packet_1"); 7 | 8 | string("QUES"); 9 | block_size_b32("string_1"); /* big endian 32 bits size */ 10 | 11 | block_begin("string_1"); 12 | fuzz_string("AAA"); 13 | 14 | string("END"); 15 | hex(0a); /* \n */ 16 | 17 | block_end("packet_1"); 18 | send("packet_1"); /* tcp */ 19 | 20 | -------------------------------------------------------------------------------- /autodafe/docs/tutorials/dummy/bad-vuln2.adc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/autodafe/docs/tutorials/dummy/bad-vuln2.adc -------------------------------------------------------------------------------- /autodafe/docs/tutorials/dummy/binary/vuln2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/autodafe/docs/tutorials/dummy/binary/vuln2 -------------------------------------------------------------------------------- /autodafe/docs/tutorials/dummy/myvuln2.ad: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------* 2 | * xml autodafe's parser v.0.1 (c) Martin Vuagnoux - 2004-2006 * 3 | * auto-generated script using PDML (Packet Details Markup Language) source * 4 | *--------------------------------------------------------------------------*/ 5 | 6 | block_begin("packet_1"); 7 | hex( 8 | 51 55 45 53 00 00 00 03 41 41 41 45 4e 44 0a 9 | ); 10 | block_end("packet_1"); 11 | recv("packet_1"); /* tcp */ 12 | 13 | block_begin("packet_2"); 14 | block_end("packet_2"); 15 | send("packet_2"); /* tcp */ 16 | 17 | -------------------------------------------------------------------------------- /autodafe/docs/tutorials/dummy/string.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/autodafe/docs/tutorials/dummy/string.txt -------------------------------------------------------------------------------- /autodafe/docs/tutorials/dummy/vuln2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/autodafe/docs/tutorials/dummy/vuln2 -------------------------------------------------------------------------------- /autodafe/docs/tutorials/dummy/vuln2-orig.ad: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------* 2 | * xml autodafe's parser v.0.1 (c) Martin Vuagnoux - 2004 * 3 | * auto-generated script using PDML (Packet Details Markup Language) source * 4 | *--------------------------------------------------------------------------*/ 5 | 6 | block_begin("packet_1"); 7 | 8 | string("QUES"); 9 | block_size_b32("string_1"); /* big endian 32 bits size */ 10 | 11 | block_begin("string_1"); 12 | fuzz_string("AAA"); 13 | block_end("string_1"); 14 | 15 | string("END"); 16 | hex(0a); /* \n */ 17 | 18 | block_end("packet_1"); 19 | send("packet_1"); /* tcp */ 20 | 21 | -------------------------------------------------------------------------------- /autodafe/docs/tutorials/dummy/vuln2.ad: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------* 2 | * xml autodafe's parser v.0.1 (c) Martin Vuagnoux - 2004 * 3 | * auto-generated script using PDML (Packet Details Markup Language) source * 4 | *--------------------------------------------------------------------------*/ 5 | 6 | block_begin("packet_1"); 7 | 8 | string("QUES"); 9 | block_size_b32("string_1"); /* big endian 32 bits size */ 10 | 11 | block_begin("string_1"); 12 | fuzz_string("AAA"); 13 | block_end("string_1"); 14 | 15 | string("END"); 16 | hex(0a); /* \n */ 17 | 18 | block_end("packet_1"); 19 | send("packet_1"); /* tcp */ 20 | 21 | -------------------------------------------------------------------------------- /autodafe/docs/tutorials/dummy/vuln2.adc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/autodafe/docs/tutorials/dummy/vuln2.adc -------------------------------------------------------------------------------- /autodafe/docs/tutorials/dummy/vuln2.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/autodafe/docs/tutorials/dummy/vuln2.o -------------------------------------------------------------------------------- /autodafe/docs/tutorials/gv-3.5.8/fuzz_hello.adc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/autodafe/docs/tutorials/gv-3.5.8/fuzz_hello.adc -------------------------------------------------------------------------------- /autodafe/docs/tutorials/gv-3.5.8/gv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/autodafe/docs/tutorials/gv-3.5.8/gv -------------------------------------------------------------------------------- /autodafe/docs/tutorials/gv-3.5.8/hello.adc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/autodafe/docs/tutorials/gv-3.5.8/hello.adc -------------------------------------------------------------------------------- /autodafe/docs/tutorials/gv-3.5.8/hello.txt: -------------------------------------------------------------------------------- 1 | Hello World! 2 | -------------------------------------------------------------------------------- /autodafe/docs/tutorials/gv-3.5.8/txt2ad.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (C) 2004 Martin Vuagnoux 4 | # 5 | # txt2ad: Convert a text file to an ad file (use string("");) 6 | 7 | 8 | help_usage() 9 | { 10 | echo "$0: convert a txt file to an ad file" 11 | echo "Copyright (C) 2004 Martin Vuagnoux " 12 | echo "USAGE : $0 (ad file is stdout)" 13 | echo "EXAMPLE: $0 ./text.txt > ./text.ad" 14 | exit 0 15 | } 16 | 17 | # test the argument 18 | if [ "$1" == "" ] 19 | then 20 | help_usage 21 | fi 22 | 23 | # test if the file exists 24 | if [ -f $1 ] 25 | then 26 | echo "block_begin(\"1\");" 27 | cat $1 | awk '{printf "string(\"%s\"); hex(0a);\n",$0}' 28 | echo "block_end(\"1\");" 29 | echo "send(\"1\");" 30 | fi 31 | -------------------------------------------------------------------------------- /autodafe/docs/tutorials/html/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/autodafe/docs/tutorials/html/index.html -------------------------------------------------------------------------------- /autodafe/etc/generator/overflow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/autodafe/etc/generator/overflow -------------------------------------------------------------------------------- /autodafe/etc/generator/overflow.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NAME: overflow.c 3 | * DATE: 2004-04-22 - Cambridge, Computer Labs. 4 | * DESC: Tired about `perl -e 'print "A"x500'` 5 | * Just write overflow -> 'A' x 6 | * Or overflow 7 | * COMPILE: gcc -Wall -O3 -o x x.c 8 | */ 9 | 10 | #include 11 | #include /* atoi */ 12 | 13 | int main(int argc, char **argv) { 14 | 15 | unsigned int i; 16 | unsigned int number; 17 | char default_string[] = "A"; 18 | char *string; 19 | 20 | if(argc < 2) { 21 | fprintf(stderr,"Usage: %s []\n", argv[0]); 22 | fprintf(stderr,"\t\t repeated times for the string.\n"); 23 | fprintf(stderr,"\t\t default: \"A\".\n"); 24 | return -1; 25 | } 26 | 27 | number = atoi(argv[1]); 28 | 29 | if(argc == 2) 30 | string = default_string; 31 | else 32 | string = argv[2]; 33 | 34 | for(i=0;i lexer.c 25 | 26 | lexer.o: parser.h 27 | 28 | clean: 29 | rm -f *~ *.o adc parser.c parser.h y.output 30 | 31 | install: all 32 | cp ./adc /usr/local/bin 33 | 34 | uninstall: 35 | rm /usr/local/bin/adc 36 | -------------------------------------------------------------------------------- /autodafe/src/adc/Makefile.in: -------------------------------------------------------------------------------- 1 | CC = @CC@ 2 | LIBS = @LIBS@ 3 | FLAGS = -O2 4 | DEFS = @DEFS@ 5 | WALL = -Wall 6 | OBJ = lexer.o parser.o 7 | LEX = @LEX@ 8 | YACC = @YACC@ 9 | 10 | all: adc 11 | 12 | .c.o: 13 | $(CC) -c $< 14 | 15 | adc: $(OBJ) 16 | $(CC) $(WALL) $(FLAGS) $^ -o $@ 17 | 18 | parser.c parser.h: parser.y 19 | $(YACC) -dtv parser.y 20 | mv -f y.tab.c parser.c 21 | mv -f y.tab.h parser.h 22 | 23 | lexer.c: lexer.l 24 | $(LEX) -t lexer.l > lexer.c 25 | 26 | lexer.o: parser.h 27 | 28 | clean: 29 | rm -f *~ *.o adc parser.c parser.h y.output 30 | 31 | install: all 32 | cp ./adc /usr/local/bin 33 | 34 | uninstall: 35 | rm /usr/local/bin/adc 36 | -------------------------------------------------------------------------------- /autodafe/src/autodafe/Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LIBS = -lz -lxml2 -lutil -lpthread -lm 3 | CFLAGS = -O2 4 | DEFS = -DHAVE_CONFIG_H 5 | WALL = -Wall 6 | OBJ = debug.o file.o dbg.o output.o chrono.o network.o transmit.o hash.o opcode.o engine.o autodafe.o 7 | 8 | all: autodafe 9 | 10 | autodafe: $(OBJ) 11 | $(CC) $(WALL) $(CFLAGS) $^ $(LIBS) -o $@ 12 | 13 | clean: 14 | rm -f *~ *.o autodafe 15 | 16 | install:all 17 | cp ./autodafe /usr/local/bin 18 | 19 | cp -r ../../etc/generator/autodafe /usr/local/etc 20 | 21 | uninstall: 22 | rm /usr/local/bin/autodafe 23 | -------------------------------------------------------------------------------- /autodafe/src/autodafe/Makefile.in: -------------------------------------------------------------------------------- 1 | CC = @CC@ 2 | LIBS = @LIBS@ 3 | CFLAGS = -O2 4 | DEFS = @DEFS@ 5 | WALL = -Wall 6 | OBJ = debug.o file.o dbg.o output.o chrono.o network.o transmit.o hash.o opcode.o engine.o autodafe.o 7 | 8 | all: autodafe 9 | 10 | autodafe: $(OBJ) 11 | $(CC) $(WALL) $(CFLAGS) $^ $(LIBS) -o $@ 12 | 13 | clean: 14 | rm -f *~ *.o autodafe 15 | 16 | install:all 17 | cp ./autodafe /usr/local/bin 18 | 19 | cp -r ../../etc/generator/autodafe /usr/local/etc 20 | 21 | uninstall: 22 | rm /usr/local/bin/autodafe 23 | -------------------------------------------------------------------------------- /autodafe/src/autodafe/chrono.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------* 2 | *--- (c) Martin Vuagnoux, Cambridge University, UK. ---* 3 | *--- Jun.2004 ---* 4 | *---------------------------------------------------------------------------*/ 5 | /*---------------------------------------------------------------------------* 6 | * NAME : chrono.h 7 | * DESCRIPTION: define parse_chrono 8 | *---------------------------------------------------------------------------*/ 9 | 10 | /*---------------------------------------------------------------------------* 11 | * NAME: parse_chrono 12 | * DESC: parse the content of the chrono structure (what send or recv) 13 | *---------------------------------------------------------------------------*/ 14 | unsigned int parse_chrono(config *conf); 15 | -------------------------------------------------------------------------------- /autodafe/src/autodafe/hash.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------* 2 | *--- (c) Martin Vuagnoux, Cambridge University, UK. ---* 3 | *--- Jun.2004 ---* 4 | *---------------------------------------------------------------------------*/ 5 | /*---------------------------------------------------------------------------* 6 | * NAME : hash.h 7 | * DESCRIPTION: hash functions 8 | *---------------------------------------------------------------------------*/ 9 | 10 | /*---------------------------------------------------------------------------* 11 | * NAME: hash_crc32(char *buffer, unsigned int size) 12 | * DESC: compute the crc32 13 | * RETN: unsigned int 32 bit crc of the buffer buffer of size size 14 | *---------------------------------------------------------------------------*/ 15 | unsigned int hash_crc32(char *buffer, unsigned int size); 16 | -------------------------------------------------------------------------------- /autodafe/src/boilerplate.mk: -------------------------------------------------------------------------------- 1 | 2 | all:: 3 | @subdirs="$(SUBDIRS)"; for d in $$subdirs; do (cd $$d; $(MAKE) $@) || exit 1; done 4 | 5 | clean:: 6 | @subdirs="$(SUBDIRS)"; for d in $$subdirs; do (cd $$d; $(MAKE) $@) || exit 1; done 7 | 8 | install:: 9 | @subdirs="$(SUBDIRS)"; for d in $$subdirs; do (cd $$d; $(MAKE) $@) || exit 1; done 10 | 11 | uninstall:: 12 | @subdirs="$(SUBDIRS)"; for d in $$subdirs; do (cd $$d; $(MAKE) $@) || exit 1; done 13 | 14 | 15 | SHELL = @SHELL@ 16 | top_srcdir = @top_srcdir@ 17 | -------------------------------------------------------------------------------- /autodafe/src/pdml2ad/Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LIBS = -lz -lxml2 -lutil -lpthread -lm -L /usr/lib 3 | CFLAGS = -O2 -I /usr/include/libxml2 4 | DEFS = -DHAVE_CONFIG_H 5 | WALL = -Wall 6 | OBJ = debug.o output.o recover.o xml.o pdml2ad.o 7 | 8 | all: pdml2ad 9 | 10 | pdml2ad: $(OBJ) 11 | $(CC) $(WALL) $(CFLAGS) $^ $(LIBS) -o $@ 12 | 13 | clean: 14 | rm -f *~ *.o pdml2ad 15 | 16 | install:all 17 | cp ./pdml2ad /usr/local/bin 18 | 19 | uninstall: 20 | rm /usr/local/bin/pdml2ad 21 | -------------------------------------------------------------------------------- /autodafe/src/pdml2ad/Makefile.in: -------------------------------------------------------------------------------- 1 | CC = @CC@ 2 | LIBS = @LIBS@ -L /usr/lib 3 | CFLAGS = -O2 -I /usr/include/libxml2 4 | DEFS = @DEFS@ 5 | WALL = -Wall 6 | OBJ = debug.o output.o recover.o xml.o pdml2ad.o 7 | 8 | all: pdml2ad 9 | 10 | pdml2ad: $(OBJ) 11 | $(CC) $(WALL) $(CFLAGS) $^ $(LIBS) -o $@ 12 | 13 | clean: 14 | rm -f *~ *.o pdml2ad 15 | 16 | install:all 17 | cp ./pdml2ad /usr/local/bin 18 | 19 | uninstall: 20 | rm /usr/local/bin/pdml2ad 21 | -------------------------------------------------------------------------------- /autodafe/src/pdml2ad/xml.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------* 2 | *--- (c) Martin Vuagnoux, Cambridge University, UK. ---* 3 | *--- Jun.2004 ---* 4 | *---------------------------------------------------------------------------*/ 5 | /*---------------------------------------------------------------------------* 6 | * NAME : xml.h 7 | * DESCRIPTION: 8 | *---------------------------------------------------------------------------*/ 9 | 10 | /*---------------------------------------------------------------------------* 11 | * NAME: xml_parsing 12 | * DESC: Main xml parsing function 13 | *---------------------------------------------------------------------------*/ 14 | void xml_parsing(config *conf); 15 | -------------------------------------------------------------------------------- /autodafe/stamp-h1: -------------------------------------------------------------------------------- 1 | timestamp for config.h 2 | -------------------------------------------------------------------------------- /autodafe/tools/overflow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/autodafe/tools/overflow -------------------------------------------------------------------------------- /autodafe/tools/overflow.c: -------------------------------------------------------------------------------- 1 | /* 2 | * NAME: overflow.c 3 | * DATE: 2004-04-22 - Cambridge, Computer Labs. 4 | * DESC: Tired about `perl -e 'print "A"x500'` 5 | * Just write overflow -> 'A' x 6 | * Or overflow 7 | * COMPILE: gcc -Wall -O3 -o x x.c 8 | */ 9 | 10 | #include 11 | #include /* atoi */ 12 | 13 | int main(int argc, char **argv) { 14 | 15 | unsigned int i; 16 | unsigned int number; 17 | char default_string[] = "A"; 18 | char *string; 19 | 20 | if(argc < 2) { 21 | fprintf(stderr,"Usage: %s []\n", argv[0]); 22 | fprintf(stderr,"\t\t repeated times for the string.\n"); 23 | fprintf(stderr,"\t\t default: \"A\".\n"); 24 | return -1; 25 | } 26 | 27 | number = atoi(argv[1]); 28 | 29 | if(argc == 2) 30 | string = default_string; 31 | else 32 | string = argv[2]; 33 | 34 | for(i=0;i 4 | # 5 | # txt2ad: Convert a text file to an ad file (use string("");) 6 | 7 | 8 | help_usage() 9 | { 10 | echo "$0: convert a txt file to an ad file" 11 | echo "Copyright (C) 2004 Martin Vuagnoux " 12 | echo "USAGE : $0 (ad file is stdout)" 13 | echo "EXAMPLE: $0 ./text.txt > ./text.ad" 14 | exit 0 15 | } 16 | 17 | # test the argument 18 | if [ "$1" == "" ] 19 | then 20 | help_usage 21 | fi 22 | 23 | # test if the file exists 24 | if [ -f $1 ] 25 | then 26 | echo "block_begin(\"1\");" 27 | cat $1 | awk '{printf "string(\"%s\"); hex(0a);\n",$0}' 28 | echo "block_end(\"1\");" 29 | echo "send(\"1\");" 30 | fi 31 | -------------------------------------------------------------------------------- /cacaphp/config.cfg: -------------------------------------------------------------------------------- 1 | [application] 2 | nb_file=1 3 | program=php 4 | program_args= 5 | mangle_percent=40 6 | timeout=2 7 | tmp_dir=/home/clem1/git/segvault/cacaphp/foo/ 8 | timeout_is_fatal=no 9 | truncate_rate=3 10 | valgrind=yes 11 | -------------------------------------------------------------------------------- /froxy/TODO: -------------------------------------------------------------------------------- 1 | * page caching 2 | * css parser 3 | * js parser 4 | * text parser (number recognition):w! 5 | 6 | -------------------------------------------------------------------------------- /fsfuzzer-0.7/AUTHORS: -------------------------------------------------------------------------------- 1 | Ilja van Sprundel - mangle.c (The version included here is modified) 2 | LMH - original idea and prototype 3 | LMH & Steve Grubb - the basic framework 4 | Eric Sandeen - gfs2 tests and some cleanups 5 | Jarod Wilson - ecryptfs test 6 | -------------------------------------------------------------------------------- /fsfuzzer-0.7/ChangeLog: -------------------------------------------------------------------------------- 1 | 0.7 2 | - Changed test driver from shell script to C for better control 3 | - Support ecryptfs tests 4 | - lots of new file systems 5 | -------------------------------------------------------------------------------- /fsfuzzer-0.7/NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/fsfuzzer-0.7/NEWS -------------------------------------------------------------------------------- /fsfuzzer-0.7/TODO: -------------------------------------------------------------------------------- 1 | Several file systems have size limits. Fix this by passing a range in. 2 | add fsck as a test in run_test. 3 | Fix ext3 so that it gets a file of the right size. Some small ones do not work. 4 | -------------------------------------------------------------------------------- /fsfuzzer-0.7/run_last: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # (c) 2006, Steve Grubb 3 | # 4 | # This software may be freely redistributed under the terms of the GNU 5 | # public license version 2. 6 | # 7 | # You should have received a copy of the GNU General Public License 8 | # along with this program; if not, write to the Free Software 9 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 10 | 11 | count=`ls cfs 2>/dev/null | wc -l` 12 | if [ $count = "0" ] ; then 13 | echo "No images to test" 14 | exit 0 15 | fi 16 | if [ $count = "1" ] ; then 17 | cmd=`ls cfs | awk -F \. '{ printf "%s %s\n", $1, $2 }'` 18 | ./run_test $cmd 19 | else 20 | echo "Too many images to pick from, run ./run_test by hand" 21 | fi 22 | -------------------------------------------------------------------------------- /fusil/AUTHORS: -------------------------------------------------------------------------------- 1 | Main developers 2 | =============== 3 | 4 | Victor Stinner aka haypo 5 | 6 | Contributor 7 | =========== 8 | 9 | Geoffroy Couprie aka geal 10 | 11 | 12 | -------------------------------------------------------------------------------- /fusil/README.windows.txt: -------------------------------------------------------------------------------- 1 | Status of Windows support 2 | ========================= 3 | 4 | Windows support of Fusil is minimal. No fuzzer works because all depends on 5 | programs missing on Windows (eg. strace for fusil-gettext). 6 | 7 | TODO 8 | ==== 9 | 10 | * SUPPORT_UID: Run child process as a different user/group 11 | * Create replay.bat (instead of replay.sh) 12 | * CreateProcess: write workaround for preexec_fn 13 | * Implement functions in fusil.process.tools (eg. limitMemory()) 14 | * Implement AttachProcessPID.checkAlive() 15 | * Implement searching a process for AttachProcessPID 16 | 17 | -------------------------------------------------------------------------------- /fusil/TODO: -------------------------------------------------------------------------------- 1 | Fusil TODO list 2 | =============== 3 | 4 | * Ptrace eip 5 | * Multi file fuzzing (dir) 6 | * Factorize code responsible to rename the session on process exit 7 | (share code between Debugger and CreateProcess) 8 | * Protect the terminal using setsid(), or setpgrp(), or setpgid(), or ... 9 | * Implement initgroups() for CreateProcess? 10 | * finish destruction of WatchProcess 11 | 12 | -------------------------------------------------------------------------------- /fusil/conv_python3.0.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | set -x 4 | 2to3 -w . fuzzers/fusil-* fuzzers/notworking/fusil-* 5 | 2to3 -w -d doc/*.rst tests/*.rst 6 | patch -p1 < python3.0.patch 7 | -------------------------------------------------------------------------------- /fusil/doc/Makefile: -------------------------------------------------------------------------------- 1 | DOCS=$(wildcard *.rst) 2 | HTML=$(patsubst %.rst,%.html,$(DOCS)) 3 | RST2HTML=rst2html 4 | 5 | all: $(HTML) 6 | @echo $(HTML) 7 | 8 | %.html: %.rst 9 | $(RST2HTML) $< $@ 10 | 11 | clean: 12 | rm -f $(HTML) 13 | -------------------------------------------------------------------------------- /fusil/doc/mas.rst: -------------------------------------------------------------------------------- 1 | Multi agent system (MAS) 2 | ======================== 3 | 4 | Univers agent is responsible to execute all agents. Univers is stopped using 5 | univers_stop() event. 6 | 7 | A session can be stopped using session_stop() event. 8 | 9 | Main MAS events: 10 | 11 | * project_start(): event received at first step but only for the first 12 | session of a project 13 | * session_start(): event received at first step on a session 14 | * session_done(score): event received at the last step of a session 15 | 16 | -------------------------------------------------------------------------------- /fusil/doc/network.rst: -------------------------------------------------------------------------------- 1 | Network server 2 | ============== 3 | 4 | - from fusil.network.server import NetworkServer 5 | - from fusil.network.tcp_server import TcpServer 6 | - from fusil.network.http_server import HttpServer 7 | 8 | On new client connection, a ServerClient object is created. 9 | 10 | Network client 11 | ============== 12 | 13 | - from fusil.network.client import NetworkClient 14 | - from fusil.network.tcp_client import TcpClient 15 | - from fusil.network.unix_client import UnixClient 16 | 17 | TpcClient methods: 18 | 19 | * __init__(project, host, port, timeout=10.0): constructor 20 | * recvBytes(max_size=None, timeout=0.250, buffer_size=1024): Read max_size 21 | bytes by chunks of buffer_size bytes, stop after timeout seconds 22 | * sendBytes(bytes): send bytes on socket. Return False on error, True 23 | on success 24 | 25 | TpcClient attributes: 26 | 27 | * host: host name/IP address 28 | * port: port number 29 | * timeout: socket timeout (in second) 30 | * tx_bytes: number of bytes sent to host 31 | * socket: socket object (set to None on error) 32 | 33 | -------------------------------------------------------------------------------- /fusil/doc/safety.rst: -------------------------------------------------------------------------------- 1 | ++++++++++++ 2 | Fusil safety 3 | ++++++++++++ 4 | 5 | Safe environment 6 | ================ 7 | 8 | To avoid computer crash, Fusil limits its own process but also child processes resources. 9 | 10 | Limitation to Fusil process are set in Application.init(): 11 | 12 | * Process priority: 19 13 | * Limit CPU usage: project.step_sleep (in second, default: 10 millisecond) 14 | * Limit memory: appplication.max_memory (in bytes, default: 100 MB) 15 | * Limit time: project.session_timeout (in second, default: disabled). 16 | See also 'time.txt' documentation. 17 | 18 | Limitation of child process: 19 | 20 | * Process priority: 19 21 | * Limit memory: default limit of 100 MB 22 | * Limit time: default timeout of 10 seconds 23 | 24 | Limitation of attached process: 25 | 26 | * Check used memory: default limit of 100 MB 27 | 28 | Be nice with CPU 29 | ================ 30 | 31 | Project waits until system CPU load is below 30% before creating a new 32 | session. It stops Fusil if system is not calm enough after 60 seconds. 33 | 34 | -------------------------------------------------------------------------------- /fusil/doc/time.rst: -------------------------------------------------------------------------------- 1 | Time managment 2 | ============== 3 | 4 | Session timeout 5 | --------------- 6 | 7 | You can set maximum session duration using Project.session_timeout option 8 | (value in second). If session reachs the timeout, it's stopped. 9 | 10 | Logging 11 | ------- 12 | 13 | Messages are written with a timestamp. 14 | 15 | TimeWatch 16 | --------- 17 | 18 | To compute session score, you can use TimeWatch probe. It has two parameters: 19 | 20 | * too_fast: mininum duration of a valid session, faster session would have 21 | 'too_fast_score' score (default: -100%) 22 | * too_long: maximum duration of a valid session, slower session would have 23 | 'too_long_score' score (default: 100%) 24 | 25 | Process 26 | ------- 27 | 28 | A process have a default timeout set to 10 seconds. If the timeout is reached, 29 | the process is directly killed using SIGKILL signal and WatchProcess will use 30 | its 'timeout_score' attribute as score (default: 100%). 31 | 32 | -------------------------------------------------------------------------------- /fusil/examples/hello-world: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # The most simple fuzzer for Fusil: just starts the command: 3 | # echo "Hello World" 4 | # 5 | # Since the process is not watched, Fusil will kills the process after the 6 | # timeout (10 seconds by default). 7 | 8 | # Reuse objets from Fusil library 9 | from fusil.application import Application 10 | from fusil.process.create import ProjectProcess 11 | 12 | # Any fuzzer have to create a class based on Application 13 | class Fuzzer(Application): 14 | # Fuzzer name: short alphanumeric string 15 | NAME = "hello" 16 | 17 | # setupProject() is the main fuzzer function: 18 | # it creates the fuzzer agents 19 | def setupProject(self): 20 | # Create an agent: don't store the object, it's already done 21 | # in the agent constructor 22 | ProjectProcess(self.project, ['echo', 'Hello World!']) 23 | 24 | if __name__ == "__main__": 25 | # Create the fuzzer application and call its method main() 26 | # Fusil will parse the command line, create all agents, and start the 27 | # fuzzing project 28 | Fuzzer().main() 29 | 30 | -------------------------------------------------------------------------------- /fusil/fusil/.c_tools.py.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/fusil/fusil/.c_tools.py.swp -------------------------------------------------------------------------------- /fusil/fusil/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/fusil/fusil/__init__.py -------------------------------------------------------------------------------- /fusil/fusil/dummy_mangle.py: -------------------------------------------------------------------------------- 1 | from fusil.mangle import MangleAgent 2 | 3 | class DummyMangle(MangleAgent): 4 | def mangleData(self, data, file_index): 5 | return data 6 | 7 | -------------------------------------------------------------------------------- /fusil/fusil/error.py: -------------------------------------------------------------------------------- 1 | class FusilError(Exception): 2 | pass 3 | 4 | -------------------------------------------------------------------------------- /fusil/fusil/linux/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/fusil/fusil/linux/__init__.py -------------------------------------------------------------------------------- /fusil/fusil/mangle_op.py: -------------------------------------------------------------------------------- 1 | def generateSpecialValues(): 2 | values = ( 3 | # Special values in big endian 4 | # SPECIAL_VALUES will contains value in big endian and little endian 5 | "\x00", 6 | "\x00\x00", 7 | "\x01", 8 | "\x00\x01", 9 | "\x7f", 10 | "\x7f\xff", 11 | "\x7f\xff\xff\xff", 12 | "\x80", 13 | "\x80\x00", 14 | "\x80\x00\x00\x00", 15 | "\xfe", 16 | "\xfe\xff", 17 | "\xfe\xff\xff\xff", 18 | "\xff", 19 | "\xff\xff", 20 | "\xff\xff\xff\xff", 21 | ) 22 | result = [] 23 | for item in values: 24 | result.append(item) 25 | itemb = item[::-1] 26 | if item != itemb: 27 | result.append(itemb) 28 | return result 29 | 30 | SPECIAL_VALUES = generateSpecialValues() 31 | 32 | MAX_INCR = 8 33 | 34 | -------------------------------------------------------------------------------- /fusil/fusil/mas/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/fusil/fusil/mas/__init__.py -------------------------------------------------------------------------------- /fusil/fusil/mas/agent_id.py: -------------------------------------------------------------------------------- 1 | class AgentID(object): 2 | instance = None 3 | counter = 0 4 | 5 | def __new__(cls): 6 | if cls.instance is None: 7 | obj = object.__new__(cls) 8 | cls.instance = obj 9 | return cls.instance 10 | 11 | def generate(self): 12 | self.counter += 1 13 | return self.counter 14 | 15 | -------------------------------------------------------------------------------- /fusil/fusil/mas/agent_list.py: -------------------------------------------------------------------------------- 1 | from ptrace.error import PTRACE_ERRORS, writeError 2 | 3 | class AgentList: 4 | def __init__(self): 5 | self.agents = [] 6 | 7 | def append(self, agent): 8 | if agent in self: 9 | raise KeyError("Agent %r already registred") 10 | self.agents.append(agent) 11 | 12 | def _destroy(self, agent): 13 | try: 14 | agent.deactivate() 15 | except PTRACE_ERRORS, error: 16 | writeError(None, error, "Agent deinit error") 17 | agent.unregister(False) 18 | 19 | def remove(self, agent, destroy=True): 20 | if agent not in self: 21 | return 22 | self.agents.remove(agent) 23 | if destroy: 24 | self._destroy(agent) 25 | 26 | def clear(self): 27 | while self.agents: 28 | agent = self.agents.pop() 29 | self._destroy(agent) 30 | 31 | def __del__(self): 32 | self.clear() 33 | 34 | def __contains__(self, agent): 35 | return agent in self.agents 36 | 37 | def __iter__(self): 38 | return iter(self.agents) 39 | 40 | -------------------------------------------------------------------------------- /fusil/fusil/mas/application_agent.py: -------------------------------------------------------------------------------- 1 | from fusil.mas.agent import Agent 2 | from weakref import ref as weakref_ref 3 | 4 | class ApplicationAgent(Agent): 5 | def __init__(self, name, application, mta): 6 | Agent.__init__(self, name, mta) 7 | self.application = weakref_ref(application) 8 | if application is not self: 9 | self.register() 10 | 11 | def register(self): 12 | self.application().registerAgent(self) 13 | 14 | def unregister(self, destroy=True): 15 | self.application().unregisterAgent(self, destroy) 16 | 17 | -------------------------------------------------------------------------------- /fusil/fusil/mas/message.py: -------------------------------------------------------------------------------- 1 | class Message: 2 | def __init__(self, event, arguments): 3 | self.event = event 4 | self.arguments = arguments 5 | 6 | def __repr__(self): 7 | return '' % ( 8 | self.event, len(self.arguments)) 9 | 10 | def __call__(self, agent): 11 | try: 12 | function = "on_%s" % self.event 13 | function = getattr(agent, function) 14 | except AttributeError: 15 | return 16 | function(*self.arguments) 17 | 18 | -------------------------------------------------------------------------------- /fusil/fusil/network/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/fusil/fusil/network/__init__.py -------------------------------------------------------------------------------- /fusil/fusil/network/tcp_client.py: -------------------------------------------------------------------------------- 1 | from fusil.network.client import NetworkClient 2 | from socket import AF_INET, SOCK_STREAM 3 | 4 | class TcpClient(NetworkClient): 5 | def __init__(self, project, host, port, connect_timeout=5.0): 6 | NetworkClient.__init__(self, project, "network:%s:%s" % (host, port)) 7 | self.host = host 8 | self.port = port 9 | self.connect_timeout = connect_timeout 10 | 11 | def on_session_start(self): 12 | self.connect( 13 | (self.host, self.port), 14 | AF_INET, SOCK_STREAM, 15 | timeout=self.connect_timeout) 16 | 17 | -------------------------------------------------------------------------------- /fusil/fusil/network/tcp_server.py: -------------------------------------------------------------------------------- 1 | from socket import AF_INET 2 | from fusil.network.server import NetworkServer 3 | from fusil.network.tools import formatAddress 4 | 5 | class TcpServer(NetworkServer): 6 | def __init__(self, project, port, host=''): 7 | name = "tcp_server:" + formatAddress(AF_INET, (host, port), short=True) 8 | NetworkServer.__init__(self, project, name) 9 | self.host = host 10 | self.port = port 11 | 12 | def init(self): 13 | if self.socket: 14 | return 15 | self.bind(address=(self.host, self.port)) 16 | 17 | -------------------------------------------------------------------------------- /fusil/fusil/network/tools.py: -------------------------------------------------------------------------------- 1 | from socket import AF_INET 2 | 3 | def formatAddress(family, address, short=False): 4 | if family == AF_INET: 5 | host, port = address 6 | if not host: 7 | host = '(localhost)' 8 | if not short: 9 | return "(host %s, port %s)" % (host, port) 10 | else: 11 | return "%s:%s" % (host, port) 12 | else: 13 | return repr(address) 14 | 15 | -------------------------------------------------------------------------------- /fusil/fusil/network/unix_client.py: -------------------------------------------------------------------------------- 1 | from fusil.network.client import NetworkClient 2 | from socket import AF_UNIX, SOCK_STREAM 3 | 4 | class UnixSocketClient(NetworkClient): 5 | def __init__(self, project, socket_filename, connect_timeout=5.0): 6 | NetworkClient.__init__(self, project, "unix_socket:%s" % socket_filename) 7 | self.socket_filename = socket_filename 8 | self.connect_timeout = connect_timeout 9 | 10 | def on_session_start(self): 11 | self.connect( 12 | self.socket_filename, 13 | AF_UNIX, SOCK_STREAM, 14 | timeout=self.connect_timeout) 15 | 16 | 17 | -------------------------------------------------------------------------------- /fusil/fusil/process/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/fusil/fusil/process/__init__.py -------------------------------------------------------------------------------- /fusil/fusil/process/cmdline.py: -------------------------------------------------------------------------------- 1 | from fusil.project_agent import ProjectAgent 2 | 3 | class CommandLine(ProjectAgent): 4 | def __init__(self, process, arguments): 5 | ProjectAgent.__init__(self, process.project(), "%s:cmdline" % process.name) 6 | self.arguments = arguments 7 | 8 | def create(self): 9 | return list(self.arguments) 10 | 11 | -------------------------------------------------------------------------------- /fusil/fusil/process/stdout.py: -------------------------------------------------------------------------------- 1 | from fusil.file_watch import FileWatch 2 | from weakref import ref as weakref_ref 3 | 4 | class WatchStdout(FileWatch): 5 | def __init__(self, process): 6 | FileWatch.__init__(self, process.project(), None, "watch:stdout") 7 | self.process = weakref_ref(process) 8 | 9 | def on_process_stdout(self, agent, filename): 10 | if agent != self.process(): 11 | return 12 | input_file = open(filename, 'rb') 13 | self.setFileObject(input_file) 14 | 15 | def on_process_exit(self, agent, status): 16 | if agent != self.process(): 17 | return 18 | self.live() 19 | self.close() 20 | 21 | def deinit(self): 22 | FileWatch.deinit(self) 23 | self.close() 24 | 25 | -------------------------------------------------------------------------------- /fusil/fusil/process/time_watch.py: -------------------------------------------------------------------------------- 1 | from fusil.time_watch import TimeWatch 2 | from time import time 3 | 4 | class ProcessTimeWatch(TimeWatch): 5 | def init(self): 6 | TimeWatch.init(self) 7 | self.time0 = None 8 | 9 | def on_process_create(self, agent): 10 | self.time0 = time() 11 | 12 | def on_session_done(self, score): 13 | pass 14 | 15 | def on_process_exit(self, agent, status): 16 | duration = time() - self.time0 17 | self.warning("Process done: duration=%.1f ms" % (duration*1000)) 18 | self.setScore(duration) 19 | 20 | -------------------------------------------------------------------------------- /fusil/fusil/python_tools.py: -------------------------------------------------------------------------------- 1 | from sys import version, hexversion 2 | 3 | RUNNING_PYPY = ("pypy" in version.lower()) 4 | RUNNING_PYTHON3 = (hexversion >= 0x03000000) 5 | 6 | -------------------------------------------------------------------------------- /fusil/fusil/score.py: -------------------------------------------------------------------------------- 1 | from fusil.tools import minmax 2 | 3 | def scoreLogFunc(object, score): 4 | if score in (None, 0): 5 | return object.info 6 | elif 0.50 <= abs(score): 7 | return object.error 8 | else: 9 | return object.warning 10 | 11 | def normalizeScore(score): 12 | score = minmax(-1.0, score, 1.0) 13 | return round(score, 2) 14 | 15 | -------------------------------------------------------------------------------- /fusil/fusil/session_agent.py: -------------------------------------------------------------------------------- 1 | from fusil.project_agent import ProjectAgent 2 | from weakref import ref as weakref_ref 3 | 4 | class SessionAgent(ProjectAgent): 5 | def __init__(self, session, name, project=None): 6 | if project: 7 | mta = project.mta() 8 | else: 9 | mta = session.mta() 10 | project = session.project() 11 | self._session = weakref_ref(session) 12 | ProjectAgent.__init__(self, project, name, mta=mta) 13 | self.activate() 14 | 15 | def session(self): 16 | return self._session() 17 | 18 | def register(self): 19 | ProjectAgent.register(self) 20 | self.session().registerAgent(self) 21 | 22 | def unregister(self, destroy=True): 23 | ProjectAgent.unregister(self, destroy) 24 | session = self.session() 25 | if session: 26 | session.unregisterAgent(self, destroy) 27 | 28 | -------------------------------------------------------------------------------- /fusil/fusil/terminal_echo.py: -------------------------------------------------------------------------------- 1 | from fusil.project_agent import ProjectAgent 2 | from ptrace.terminal import enableEchoMode 3 | 4 | class TerminalEcho(ProjectAgent): 5 | def __init__(self, project): 6 | ProjectAgent.__init__(self, project, "terminal") 7 | 8 | def deinit(self): 9 | if enableEchoMode(): 10 | self.info("Terminal: restore echo mode to stdin") 11 | 12 | -------------------------------------------------------------------------------- /fusil/fusil/unsafe.py: -------------------------------------------------------------------------------- 1 | from ptrace.os_tools import RUNNING_WINDOWS 2 | SUPPORT_UID = not RUNNING_WINDOWS 3 | if SUPPORT_UID: 4 | from os import getuid 5 | 6 | def permissionHelp(options): 7 | """ 8 | On "Operation not permitted error", propose some help to fix this problem. 9 | Example: "retry as root". 10 | """ 11 | if not SUPPORT_UID: 12 | return None 13 | help = [] 14 | if getuid() != 0: 15 | help.append('retry as root') 16 | if not options.unsafe: 17 | help.append('use --unsafe option') 18 | if not help: 19 | return None 20 | return ' or '.join(help) 21 | 22 | -------------------------------------------------------------------------------- /fusil/fusil/version.py: -------------------------------------------------------------------------------- 1 | PACKAGE = "fusil" 2 | VERSION = "1.2.2" 3 | WEBSITE = "http://fusil.hachoir.org/" 4 | LICENSE = "GNU GPL v2" 5 | -------------------------------------------------------------------------------- /fusil/fusil/xhost.py: -------------------------------------------------------------------------------- 1 | from fusil.process.tools import locateProgram 2 | 3 | def xhostCommand(xhost_program, user, allow=True): 4 | if not xhostCommand.program: 5 | xhostCommand.program = locateProgram( 6 | xhost_program, 7 | raise_error=True) 8 | if allow: 9 | prefix = '+' 10 | else: 11 | prefix = '-' 12 | return [ 13 | xhostCommand.program, 14 | "%slocal:%s" % (prefix, user)] 15 | xhostCommand.program = None 16 | 17 | -------------------------------------------------------------------------------- /fusil/fuzzers/notworking/.fusil-linux-sopt.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/fusil/fuzzers/notworking/.fusil-linux-sopt.swp -------------------------------------------------------------------------------- /fusil/graph.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | DATA=$1 3 | OUTPUT=/tmp/graph.png 4 | 5 | if [ "x$DATA" = "x" ]; then 6 | echo "usage: $0 aggressivity.dat" 7 | exit 1 8 | fi 9 | 10 | if [ ! -f "$DATA" ]; then 11 | echo "File $DATA doesn't exit" 12 | exit 1 13 | fi 14 | 15 | # Exit on error 16 | set -e 17 | 18 | cat < /proc/sys/kernel/randomize_va_space' 3 | -------------------------------------------------------------------------------- /fusil/lsall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | find fusil -name "*.py" 3 | ls -1 examples/* 4 | ls -1 fuzzers/fusil-* 5 | ls -1 fuzzers/notworking/fusil-* 6 | -------------------------------------------------------------------------------- /fusil/ptrace/AUTHORS: -------------------------------------------------------------------------------- 1 | python-ptrace authors 2 | ===================== 3 | 4 | Dimitris Glynos - follow gdb.py commands 5 | Mark Seaborn - Create -i option for strace 6 | Mickaël Guérin aka KAeL - OpenBSD port 7 | T. Bursztyka aka Tuna - x86_64 port 8 | Victor Stinner - python-ptrace author and maintainer 9 | 10 | 11 | Thanks 12 | ====== 13 | 14 | * procps authors (top and uptime programs) 15 | 16 | -------------------------------------------------------------------------------- /fusil/ptrace/INSTALL: -------------------------------------------------------------------------------- 1 | ptrace dependencies 2 | =================== 3 | 4 | * Python 2.5+: 5 | http://python.org/ 6 | * distorm disassembler (optional) 7 | http://www.ragestorm.net/distorm/ 8 | 9 | 10 | Installation 11 | ============ 12 | 13 | Type as root: :: 14 | 15 | ./setup.py install 16 | 17 | Or using sudo program: :: 18 | 19 | sudo python setup.py install 20 | 21 | 22 | cptrace 23 | ======= 24 | 25 | For faster debug, you can also install cptrace: Python binding of the ptrace() 26 | function written in C: :: 27 | 28 | ./setup_cptrace.py install 29 | 30 | -------------------------------------------------------------------------------- /fusil/ptrace/README: -------------------------------------------------------------------------------- 1 | python-ptrace is a Python binding of ptrace library. 2 | 3 | The binding works on: 4 | 5 | * Linux version 2.6.20 on i386, x86_64, PPC (may works on Linux 2.4.x 6 | and 2.6.x) 7 | * Linux version 2.4 on PPC 8 | * FreeBSD version 7.0RC1 on i386 (may works on FreeBSD 5.x/6.x) 9 | * OpenBSD version 4.2 on i386 10 | 11 | Features: 12 | 13 | * High level Python object API : !PtraceDebugger and !PtraceProcess 14 | * Able to control multiple processes: catch fork events on Linux 15 | * Read/write bytes to arbitrary address: take care of memory alignment and 16 | split bytes to cpu word 17 | * Execution step by step using ptrace_singlestep() or hardware interruption 3 18 | * Can use distorm (http://www.ragestorm.net/distorm/) disassembler 19 | * Dump registers, memory mappings, stack, etc. 20 | * Syscall tracer and parser (strace command) 21 | 22 | Website: http://python-ptrace.hachoir.org/ 23 | 24 | 25 | Installation 26 | ============ 27 | 28 | Read INSTALL documentation file. 29 | 30 | Documentation 31 | ============= 32 | 33 | Browse doc/ and examples/ directories. 34 | 35 | -------------------------------------------------------------------------------- /fusil/ptrace/README.cptrace: -------------------------------------------------------------------------------- 1 | +++++++++++++++++++++ 2 | cptrace Python module 3 | +++++++++++++++++++++ 4 | 5 | Python binding for ptrace written in C. 6 | 7 | Example 8 | ======= 9 | 10 | Dummy example: :: 11 | 12 | >>> import cptrace 13 | >>> cptrace.ptrace(1, 1) 14 | Traceback (most recent call last): 15 | File "", line 1, in 16 | ValueError: ptrace(request=1, pid=1, 0x(nil), 0x(nil)) error #1: Operation not permitted 17 | 18 | 19 | -------------------------------------------------------------------------------- /fusil/ptrace/conv_python3.0.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | set -x 4 | 2to3 -w . 5 | 2to3 -w -d . 6 | patch -p1 < python3.0.patch 7 | -------------------------------------------------------------------------------- /fusil/ptrace/cptrace/Makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | CFLAGS=-fPIC -shared -Wall -Wextra -Wextra $(shell python-config --cflags) 3 | LIBS=$(shell python-config --libs) 4 | LIBRARY=cptrace.so 5 | 6 | $(LIBRARY): cptrace.c 7 | $(CC) -o $@ $< $(CFLAGS) $(LIBS) 8 | 9 | clean: 10 | rm -f $(LIBRARY) 11 | -------------------------------------------------------------------------------- /fusil/ptrace/cptrace/version.py: -------------------------------------------------------------------------------- 1 | PACKAGE = "cptrace" 2 | VERSION = "0.6.1" 3 | WEBSITE = "http://python-ptrace.hachoir.org/" 4 | LICENSE = "GNU GPL v2" 5 | -------------------------------------------------------------------------------- /fusil/ptrace/doc/ptrace_signal.rst: -------------------------------------------------------------------------------- 1 | ++++++++++++ 2 | PtraceSignal 3 | ++++++++++++ 4 | 5 | 6 | Introduction 7 | ============ 8 | 9 | PtraceSignal tries to display useful informations when a signal is received. 10 | Depending on the signal number, it show different informations. 11 | 12 | It uses the current instruction decoded as assembler code to understand why 13 | the signal is raised. 14 | 15 | Only Intel x86 (i386, maybe x86_64) is supported now. 16 | 17 | 18 | Examples 19 | ======== 20 | 21 | Invalid read: :: 22 | 23 | Signal: SIGSEGV 24 | Invalid read from 0x00000008 25 | - instruction: MOV EAX, [EAX+0x8] 26 | - mapping: (no memory mapping) 27 | - register eax=0x00000000 28 | 29 | Invalid write (MOV): :: 30 | 31 | Signal: SIGSEGV 32 | Invalid write to 0x00000008 (size=4 bytes) 33 | - instruction: MOV DWORD [EAX+0x8], 0x2a 34 | - mapping: (no memory mapping) 35 | - register eax=0x00000000 36 | 37 | abort(): :: 38 | 39 | Signal: SIGABRT 40 | Program received signal SIGABRT, Aborted. 41 | 42 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/__init__.py: -------------------------------------------------------------------------------- 1 | from ptrace.signames import SIGNAMES, signalName 2 | from ptrace.error import PtraceError 3 | 4 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/binding/__init__.py: -------------------------------------------------------------------------------- 1 | from ptrace.binding.func import ( 2 | HAS_PTRACE_SINGLESTEP, HAS_PTRACE_EVENTS, 3 | HAS_PTRACE_IO, HAS_PTRACE_SIGINFO, HAS_PTRACE_GETREGS, 4 | REGISTER_NAMES, 5 | ptrace_attach, ptrace_traceme, 6 | ptrace_detach, ptrace_kill, 7 | ptrace_cont, ptrace_syscall, 8 | ptrace_setregs, 9 | ptrace_peektext, ptrace_poketext, 10 | ptrace_peekuser, 11 | ptrace_registers_t) 12 | if HAS_PTRACE_EVENTS: 13 | from ptrace.binding.func import (WPTRACEEVENT, 14 | PTRACE_EVENT_FORK, PTRACE_EVENT_VFORK, PTRACE_EVENT_CLONE, 15 | PTRACE_EVENT_EXEC, 16 | ptrace_setoptions, ptrace_geteventmsg) 17 | if HAS_PTRACE_SINGLESTEP: 18 | from ptrace.binding.func import ptrace_singlestep 19 | if HAS_PTRACE_SIGINFO: 20 | from ptrace.binding.func import ptrace_getsiginfo 21 | if HAS_PTRACE_IO: 22 | from ptrace.binding.func import ptrace_io 23 | from ptrace.binding.freebsd_struct import ( 24 | ptrace_io_desc, 25 | PIOD_READ_D, PIOD_WRITE_D, 26 | PIOD_READ_I,PIOD_WRITE_I) 27 | if HAS_PTRACE_GETREGS: 28 | from ptrace.binding.func import ptrace_getregs 29 | 30 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/binding/freebsd_struct.py: -------------------------------------------------------------------------------- 1 | from ctypes import Structure, c_int, c_uint, c_ulong, c_void_p 2 | 3 | PIOD_READ_D = 1 4 | PIOD_WRITE_D = 2 5 | PIOD_READ_I = 3 6 | PIOD_WRITE_I = 4 7 | 8 | size_t = c_ulong 9 | 10 | # /usr/include/machine/reg.h 11 | class reg(Structure): 12 | _fields_ = ( 13 | ("fs", c_uint), 14 | ("es", c_uint), 15 | ("ds", c_uint), 16 | ("edi", c_uint), 17 | ("esi", c_uint), 18 | ("ebp", c_uint), 19 | ("isp", c_uint), 20 | ("ebx", c_uint), 21 | ("edx", c_uint), 22 | ("ecx", c_uint), 23 | ("eax", c_uint), 24 | ("trapno", c_uint), 25 | ("err", c_uint), 26 | ("eip", c_uint), 27 | ("cs", c_uint), 28 | ("eflags", c_uint), 29 | ("esp", c_uint), 30 | ("ss", c_uint), 31 | ("gs", c_uint), 32 | ) 33 | 34 | class ptrace_io_desc(Structure): 35 | _fields_ = ( 36 | ("piod_op", c_int), 37 | ("piod_offs", c_void_p), 38 | ("piod_addr", c_void_p), 39 | ("piod_len", size_t), 40 | ) 41 | 42 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/binding/openbsd_struct.py: -------------------------------------------------------------------------------- 1 | from ctypes import Structure, c_int, c_uint, c_ulong, c_void_p, c_char 2 | 3 | PIOD_READ_D = 1 4 | PIOD_WRITE_D = 2 5 | PIOD_READ_I = 3 6 | PIOD_WRITE_I = 4 7 | 8 | size_t = c_ulong 9 | pid_t = c_int 10 | 11 | # /usr/include/machine/reg.h 12 | class reg(Structure): 13 | _fields_ = ( 14 | ("eax", c_uint), 15 | ("ecx", c_uint), 16 | ("edx", c_uint), 17 | ("ebx", c_uint), 18 | ("esp", c_uint), 19 | ("ebp", c_uint), 20 | ("esi", c_uint), 21 | ("edi", c_uint), 22 | ("eip", c_uint), 23 | ("eflags", c_uint), 24 | ("cs", c_uint), 25 | ("ss", c_uint), 26 | ("ds", c_uint), 27 | ("es", c_uint), 28 | ("fs", c_uint), 29 | ("gs", c_uint), 30 | ) 31 | 32 | class fpreg(Structure): 33 | _fields_ = ( 34 | ("__data", c_char * 116), 35 | ) 36 | 37 | class ptrace_io_desc(Structure): 38 | _fields_ = ( 39 | ("piod_op", c_int), 40 | ("piod_offs", c_void_p), 41 | ("piod_addr", c_void_p), 42 | ("piod_len", size_t), 43 | ) 44 | 45 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/compatibility.py: -------------------------------------------------------------------------------- 1 | """ 2 | Compatibility functions for Python 2.4. 3 | 4 | any() function 5 | ============== 6 | 7 | any() returns True if at least one items is True, or False otherwise. 8 | 9 | >>> any([False, True]) 10 | True 11 | >>> any([True, True]) 12 | True 13 | >>> any([False, False]) 14 | False 15 | 16 | 17 | all() function 18 | ============== 19 | 20 | all() returns True if all items are True, or False otherwise. 21 | This function is just apply binary and operator (&) on all values. 22 | 23 | >>> all([True, True]) 24 | True 25 | >>> all([False, True]) 26 | False 27 | >>> all([False, False]) 28 | False 29 | """ 30 | 31 | import operator 32 | 33 | # --- any() from Python 2.5 --- 34 | try: 35 | from __builtin__ import any 36 | except ImportError: 37 | def any(items): 38 | for item in items: 39 | if item: 40 | return True 41 | return False 42 | 43 | # ---all() from Python 2.5 --- 44 | try: 45 | from __builtin__ import all 46 | except ImportError: 47 | def all(items): 48 | return reduce(operator.__and__, items) 49 | 50 | __all__ = ("any", "all") 51 | 52 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/ctypes_libc.py: -------------------------------------------------------------------------------- 1 | """ 2 | Load the system C library. Variables: 3 | - LIBC_FILENAME: the C library filename 4 | - libc: the loaded library 5 | """ 6 | 7 | from ctypes import cdll 8 | from ctypes.util import find_library 9 | 10 | LIBC_FILENAME = find_library('c') 11 | libc = cdll.LoadLibrary(LIBC_FILENAME) 12 | 13 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/debugger/__init__.py: -------------------------------------------------------------------------------- 1 | from ptrace.debugger.breakpoint import Breakpoint 2 | from ptrace.debugger.process_event import (ProcessEvent, 3 | ProcessExit, NewProcessEvent, ProcessExecution) 4 | from ptrace.debugger.ptrace_signal import ProcessSignal 5 | from ptrace.debugger.process_error import ProcessError 6 | from ptrace.debugger.child import ChildError 7 | from ptrace.debugger.process import PtraceProcess 8 | from ptrace.debugger.debugger import PtraceDebugger, DebuggerError 9 | from ptrace.debugger.application import Application 10 | 11 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/debugger/process_error.py: -------------------------------------------------------------------------------- 1 | from ptrace.error import PtraceError 2 | 3 | class ProcessError(PtraceError): 4 | def __init__(self, process, message): 5 | PtraceError.__init__(self, message, pid=process.pid) 6 | self.process = process 7 | 8 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/logging_tools.py: -------------------------------------------------------------------------------- 1 | from ptrace.tools import minmax 2 | from logging import ERROR, WARNING, INFO, DEBUG 3 | 4 | def getLogFunc(logger, level): 5 | """ 6 | Get the logger function for the specified logging level. 7 | """ 8 | if level == ERROR: 9 | return logger.error 10 | elif level == WARNING: 11 | return logger.warning 12 | elif level == INFO: 13 | return logger.info 14 | elif level == DEBUG: 15 | return logger.debug 16 | else: 17 | return logger.error 18 | 19 | def changeLogLevel(level, delta): 20 | """ 21 | Compute log level and make sure that the result is in DEBUG..ERROR. 22 | 23 | >>> changeLogLevel(ERROR, -1) == WARNING 24 | True 25 | >>> changeLogLevel(DEBUG, 1) == INFO 26 | True 27 | """ 28 | return minmax(DEBUG, level + delta*10, ERROR) 29 | 30 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/mockup.py: -------------------------------------------------------------------------------- 1 | """ 2 | Mockup classes used in unit tests. 3 | """ 4 | 5 | class FakeProcess: 6 | def __init__(self): 7 | self.regs = {} 8 | 9 | def setreg(self, name, value): 10 | self.regs[name] = value 11 | 12 | def getreg(self, name): 13 | return self.regs[name] 14 | 15 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/os_tools.py: -------------------------------------------------------------------------------- 1 | """ 2 | Constants about the operating system: 3 | 4 | - RUNNING_PYPY (bool) 5 | - RUNNING_WINDOWS (bool) 6 | - RUNNING_LINUX (bool) 7 | - RUNNING_FREEBSD (bool) 8 | - RUNNING_OPENBSD (bool) 9 | - RUNNING_MACOSX (bool) 10 | - RUNNING_BSD (bool) 11 | - HAS_PROC (bool) 12 | - HAS_PTRACE (bool) 13 | """ 14 | 15 | from sys import platform, version 16 | 17 | RUNNING_PYPY = ("pypy" in version.lower()) 18 | RUNNING_WINDOWS = (platform == 'win32') 19 | RUNNING_LINUX = (platform == 'linux2') 20 | RUNNING_FREEBSD = platform.startswith('freebsd') 21 | RUNNING_OPENBSD = platform.startswith('openbsd') 22 | RUNNING_MACOSX = (platform == 'darwin') 23 | RUNNING_BSD = RUNNING_FREEBSD or RUNNING_MACOSX or RUNNING_OPENBSD 24 | 25 | HAS_PROC = RUNNING_LINUX 26 | HAS_PTRACE = (RUNNING_BSD or RUNNING_LINUX) 27 | 28 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/syscall/__init__.py: -------------------------------------------------------------------------------- 1 | from ptrace.syscall.names import SYSCALL_NAMES 2 | from ptrace.syscall.prototypes import SYSCALL_PROTOTYPES, FILENAME_ARGUMENTS 3 | from ptrace.syscall.syscall_argument import SyscallArgument 4 | from ptrace.syscall.ptrace_syscall import PtraceSyscall 5 | 6 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/syscall/freebsd_constants.py: -------------------------------------------------------------------------------- 1 | from ptrace.syscall.posix_constants import SYSCALL_ARG_DICT 2 | 3 | RLIMIT_RESOURCE = { 4 | 0: "RLIMIT_CPU", 5 | 1: "RLIMIT_FSIZE", 6 | 2: "RLIMIT_DATA", 7 | 3: "RLIMIT_STACK", 8 | 4: "RLIMIT_CORE", 9 | 5: "RLIMIT_RSS", 10 | 6: "RLIMIT_MEMLOCK", 11 | 7: "RLIMIT_NPROC", 12 | 8: "RLIMIT_NOFILE", 13 | 9: "RLIMIT_SBSIZE", 14 | 10: "RLIMIT_VMEM", 15 | } 16 | 17 | SIGPROCMASK_HOW = {1:" SIG_BLOCK", 2: "SIG_UNBLOCK", 3: "SIG_SETMASK"} 18 | 19 | SYSCALL_ARG_DICT.update({ 20 | "getrlimit": {"resource": RLIMIT_RESOURCE}, 21 | "setrlimit": {"resource": RLIMIT_RESOURCE}, 22 | "sigprocmask": {"how": SIGPROCMASK_HOW}, 23 | "rt_sigprocmask": {"how": SIGPROCMASK_HOW}, 24 | }) 25 | 26 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/syscall/linux_constants.py: -------------------------------------------------------------------------------- 1 | from ptrace.syscall.posix_constants import SYSCALL_ARG_DICT 2 | 3 | SIGSET_SIZE = 64 4 | FD_SETSIZE = 1024 5 | 6 | RLIMIT_RESOURCE = { 7 | 0: "RLIMIT_CPU", 8 | 1: "RLIMIT_FSIZE", 9 | 2: "RLIMIT_DATA", 10 | 3: "RLIMIT_STACK", 11 | 4: "RLIMIT_CORE", 12 | 5: "RLIMIT_RSS", 13 | 6: "RLIMIT_NPROC", 14 | 7: "RLIMIT_NOFILE", 15 | 8: "RLIMIT_MEMLOCK", 16 | 9: "RLIMIT_AS", 17 | 10: "RLIMIT_LOCKS", 18 | 11: "RLIMIT_SIGPENDING", 19 | 12: "RLIMIT_MSGQUEUE", 20 | 13: "RLIMIT_NICE", 21 | 14: "RLIMIT_RTPRIO", 22 | 15: "RLIMIT_NLIMITS", 23 | } 24 | 25 | SIGPROCMASK_HOW = {0: "SIG_BLOCK", 1: "SIG_UNBLOCK", 2: "SIG_SETMASK"} 26 | 27 | SYSCALL_ARG_DICT.update({ 28 | "getrlimit": {"resource": RLIMIT_RESOURCE}, 29 | "setrlimit": {"resource": RLIMIT_RESOURCE}, 30 | "sigprocmask": {"how": SIGPROCMASK_HOW}, 31 | "rt_sigprocmask": {"how": SIGPROCMASK_HOW}, 32 | }) 33 | 34 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/syscall/names.py: -------------------------------------------------------------------------------- 1 | from ptrace.cpu_info import CPU_64BITS 2 | from ptrace.os_tools import RUNNING_LINUX, RUNNING_FREEBSD 3 | if RUNNING_LINUX: 4 | if CPU_64BITS: 5 | from ptrace.syscall.linux_syscall64 import SYSCALL_NAMES 6 | else: 7 | from ptrace.syscall.linux_syscall32 import SYSCALL_NAMES 8 | elif RUNNING_FREEBSD: 9 | from ptrace.syscall.freebsd_syscall import SYSCALL_NAMES 10 | else: 11 | SYSCALL_NAMES = {} 12 | 13 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/terminal.py: -------------------------------------------------------------------------------- 1 | """ 2 | Terminal functions. 3 | """ 4 | 5 | from termios import tcgetattr, tcsetattr, ECHO, TCSADRAIN, TIOCGWINSZ 6 | from sys import stdin, stdout 7 | from fcntl import ioctl 8 | from struct import unpack 9 | 10 | TERMIO_LFLAGS = 3 11 | 12 | def _terminalSize(): 13 | fd = stdout.fileno() 14 | size = ioctl(fd, TIOCGWINSZ, '1234') 15 | height, width = unpack('hh', size) 16 | return (width, height) 17 | 18 | def terminalWidth(): 19 | """ 20 | Get the terminal width in characters. 21 | """ 22 | return _terminalSize()[0] 23 | 24 | def enableEchoMode(): 25 | """ 26 | Enable echo mode in the terminal. Return True if the echo mode is set 27 | correctly, or False if the mode was already set. 28 | """ 29 | fd = stdin.fileno() 30 | state = tcgetattr(fd) 31 | if state[TERMIO_LFLAGS] & ECHO: 32 | return False 33 | state[TERMIO_LFLAGS] = state[TERMIO_LFLAGS] | ECHO 34 | tcsetattr(fd, TCSADRAIN, state) 35 | return True 36 | 37 | 38 | -------------------------------------------------------------------------------- /fusil/ptrace/ptrace/version.py: -------------------------------------------------------------------------------- 1 | PACKAGE = "python-ptrace" 2 | VERSION = "0.6.1" 3 | WEBSITE = "http://python-ptrace.hachoir.org/" 4 | LICENSE = "GNU GPL v2" 5 | -------------------------------------------------------------------------------- /fusil/ptrace/pyflakes.sh: -------------------------------------------------------------------------------- 1 | pyflakes $(find -name "*.py")|grep -v "redefinition of unused"|grep -v "__init__.*imported but unused" 2 | -------------------------------------------------------------------------------- /fusil/ptrace/tests/crash/BSDmakefile: -------------------------------------------------------------------------------- 1 | SOURCES=stack_overflow.c div_zero.c call_null.c abort.c fork.c invalid_write.c invalid_read.c 2 | PROGRAMS=${SOURCES:S/.c//g} pthread 3 | CFLAGS=-Wall -O0 -g 4 | 5 | all: $(PROGRAMS) 6 | 7 | pthread: pthread.c 8 | $(CC) -o $@ $(CFLAGS) pthread.c -lpthread 9 | 10 | 11 | clean: 12 | rm -f $(PROGRAMS) 13 | 14 | -------------------------------------------------------------------------------- /fusil/ptrace/tests/crash/Makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | SOURCES=stack_overflow.c div_zero.c call_null.c abort.c fork.c execve.c invalid_write.c invalid_read.c socket_ipv4_tcp.c 3 | PROGRAMS=$(patsubst %.c,%,$(SOURCES)) pthread 4 | CFLAGS=-Wall -Wextra -Werror -O0 -g 5 | 6 | all: $(PROGRAMS) 7 | 8 | pthread: pthread.c 9 | $(CC) -o $@ $(CFLAGS) pthread.c -lpthread 10 | 11 | clean: 12 | rm -f $(PROGRAMS) 13 | 14 | -------------------------------------------------------------------------------- /fusil/ptrace/tests/crash/abort.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | abort(); 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /fusil/ptrace/tests/crash/call_null.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | void (*func) (void) = 0; 4 | func(); 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /fusil/ptrace/tests/crash/div_zero.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | int x = 1; 4 | int y = 0; 5 | x /= y; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /fusil/ptrace/tests/crash/execve.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main() 7 | { 8 | char *arg[]= {"/bin/ls", NULL }; 9 | int pid; 10 | 11 | pid = fork(); 12 | 13 | if (pid) { 14 | waitpid(pid, NULL, 0); 15 | exit(EXIT_SUCCESS); 16 | } else { 17 | (void)uname(NULL); 18 | execve(arg[0], arg, NULL); 19 | exit(EXIT_FAILURE); 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /fusil/ptrace/tests/crash/invalid_read.c: -------------------------------------------------------------------------------- 1 | typedef struct 2 | { 3 | int x; 4 | int y; 5 | int z; 6 | } point_t; 7 | 8 | int main() 9 | { 10 | point_t *point = 0; 11 | int z; 12 | z = point->z; 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /fusil/ptrace/tests/crash/invalid_write.c: -------------------------------------------------------------------------------- 1 | typedef struct 2 | { 3 | int x; 4 | int y; 5 | int z; 6 | } point_t; 7 | 8 | int main() 9 | { 10 | point_t *point = 0; 11 | point->z = 42; 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /fusil/ptrace/tests/crash/pthread.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define UNUSED(x) x __attribute__((unused)) 5 | 6 | pthread_t thread; 7 | pthread_mutex_t mutex; 8 | int global_counter; 9 | 10 | void* nothing(void *UNUSED(data)) 11 | { 12 | printf("[thread] exit thread\n"); 13 | pthread_exit(NULL); 14 | } 15 | 16 | int main() 17 | { 18 | global_counter = 1; 19 | 20 | printf("[main] create thread\n"); 21 | pthread_create(&thread, NULL, nothing, NULL); 22 | printf("[main] join thread\n"); 23 | pthread_join(thread, NULL); 24 | printf("[main] exit\n"); 25 | pthread_mutex_destroy(&mutex); 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /fusil/ptrace/tests/crash/socket_ipv4_tcp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include /* close() */ 3 | #include /* perror() */ 4 | #include /* struct sockaddr_in */ 5 | 6 | int main() 7 | { 8 | int fd; 9 | int val; 10 | int ret; 11 | struct sockaddr_in addr; 12 | 13 | fd = socket(PF_INET, SOCK_STREAM, 0); 14 | if (fd < 0) 15 | perror("socket"); 16 | 17 | val = 1; 18 | (void)setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)); 19 | 20 | addr.sin_family = AF_INET; 21 | addr.sin_port = htons(80); 22 | addr.sin_addr.s_addr = 0x7f000001; 23 | ret = connect(fd, (struct sockaddr*)&addr, sizeof(addr)); 24 | if (ret < 0) 25 | perror("connect"); 26 | 27 | ret = close(fd); 28 | if (ret) 29 | perror("close"); 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /fusil/ptrace/tests/crash/stack_overflow.c: -------------------------------------------------------------------------------- 1 | void toto() 2 | { 3 | char buffer[4096]; 4 | buffer[0] = 0; 5 | toto(); 6 | } 7 | 8 | int main() 9 | { 10 | toto(); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /fusil/pyflakes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | pyflakes $(find fusil -name "*.py") examples/* fuzzers/fusil-* fuzzers/notworking/fusil-* 3 | -------------------------------------------------------------------------------- /fusil/tests/cmd_help/ping.help: -------------------------------------------------------------------------------- 1 | ping: invalid option -- - 2 | Usage: ping [-LRUbdfnqrvVaA] [-c count] [-i interval] [-w deadline] 3 | [-p pattern] [-s packetsize] [-t ttl] [-I interface or address] 4 | [-M mtu discovery hint] [-S sndbuf] 5 | [ -T timestamp option ] [ -Q tos ] [hop1 ...] destination 6 | -------------------------------------------------------------------------------- /fusil/tests/file_watch_ignore.rst: -------------------------------------------------------------------------------- 1 | >>> from fusil.mockup import Project, Logger 2 | >>> from fusil.file_watch import FileWatch 3 | >>> from os import unlink 4 | >>> from StringIO import StringIO 5 | >>> logger = Logger(show=True) 6 | >>> project = Project(logger) 7 | 8 | >>> buffer = StringIO() 9 | >>> def writeText(text): 10 | ... buffer.write(text) 11 | ... 12 | >>> watch = FileWatch(project, buffer, 'test') 13 | >>> watch.show_matching = True 14 | >>> watch.show_not_matching = True 15 | >>> watch.ignoreRegex("[Hh]ello") 16 | >>> watch.ignoreRegex("hello") 17 | >>> watch.addRegex('XDSDFOS', 1.0) 18 | >>> watch.init() 19 | >>> writeText("HELLO\nhello\nHello\n") 20 | >>> watch.live() 21 | Not matching line: 'HELLO' 22 | >>> writeText("this is an error\n") 23 | >>> watch.live() 24 | Match pattern 'error' (score 30.0%) in 'this is an error' 25 | >>> writeText("test pattern XDSDFOS\n") 26 | >>> watch.live() 27 | Match pattern 'XDSDFOS' (score 100.0%) in 'test pattern XDSDFOS' 28 | 29 | -------------------------------------------------------------------------------- /fusil/tests/file_watch_read.rst: -------------------------------------------------------------------------------- 1 | >>> filename = 'test.txt' 2 | >>> from fusil.mockup import Project 3 | >>> from fusil.file_watch import FileWatch 4 | >>> from os import unlink 5 | >>> from StringIO import StringIO 6 | >>> output = open(filename, 'w') 7 | >>> def writeText(text): 8 | ... output.write(text) 9 | ... output.flush() 10 | >>> input = open(filename, 'r') 11 | >>> project = Project() 12 | >>> watch = FileWatch(project, input, 'test') 13 | >>> watch.read_size = 1 14 | >>> watch.init() 15 | >>> list(watch.readlines()) 16 | [] 17 | >>> writeText('da') 18 | >>> list(watch.readlines()) 19 | [] 20 | >>> writeText('t') 21 | >>> list(watch.readlines()) 22 | [] 23 | >>> writeText('a\n') 24 | >>> list(watch.readlines()) 25 | ['data'] 26 | >>> writeText('linea\nlineb\n') 27 | >>> list(watch.readlines()) 28 | ['linea', 'lineb'] 29 | >>> writeText('line1\nline2\nline') 30 | >>> list(watch.readlines()) 31 | ['line1', 'line2'] 32 | >>> writeText('3\n') 33 | >>> list(watch.readlines()) 34 | ['line3'] 35 | >>> unlink(filename) 36 | 37 | -------------------------------------------------------------------------------- /hachoir/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/README -------------------------------------------------------------------------------- /hachoir/benchmark.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "x$PYTHON" = "x" ]; then 4 | PYTHON=`which python2.4` 5 | fi 6 | PYTHON=$PYTHON 7 | ROOT=$(cd `dirname $0`; pwd) 8 | TESTCASE=$HOME/testcase 9 | export PYTHONPATH=$ROOT/hachoir-core:$ROOT/hachoir-parser:$ROOT/hachoir-metadata:$PYTHONPATH 10 | 11 | function prepare_benchmark 12 | { 13 | echo 14 | echo "=== $1 ===" 15 | sync 16 | } 17 | 18 | HACHOIR_VERSION=`$PYTHON $ROOT/hachoir-core/get_version.py` 19 | PYTHON_VERSION=`$PYTHON -c 'from sys import version; print version.split("\n")[0].split("(")[0].strip()' 2>&1` 20 | echo "Benchmark Hachoir version $HACHOIR_VERSION on Python $PYTHON_VERSION" 21 | 22 | prepare_benchmark "hachoir-grep: yellowcase" 23 | $PYTHON -OO $ROOT/hachoir-tools/hachoir-grep --bench --all $TESTCASE/yellowdude.3ds 24 | 25 | prepare_benchmark "hachoir-metadata: set A (mp3, wav, png, au, mkv)" 26 | (cd $TESTCASE; $PYTHON -OO $ROOT/hachoir-metadata/hachoir-metadata \ 27 | --bench --quiet \ 28 | sheep_on_drugs.mp3 KDE_Click.wav logo-Kubuntu.png \ 29 | audio_8khz_8bit_ulaw_4s39.au flashmob.mkv 10min.mkv) 30 | 31 | -------------------------------------------------------------------------------- /hachoir/bitarray/AUTHORS: -------------------------------------------------------------------------------- 1 | bitarray is written and maintained by 2 | Ilan Schnell 3 | 4 | The author would like to thank the following people for feedback, 5 | suggestions, and discussions (in arbitrary order): 6 | Kris Kennaway 7 | Travis Oliphant 8 | Gael Varoquaux 9 | David Ormsbee 10 | David Kammeyer 11 | Bryce Hendrix 12 | Judah De Paula 13 | Corran Webster 14 | Chris Mueller 15 | Koen van de Sande 16 | Paul McGuire 17 | Daniel Stutzbach (for help with reference counts) 18 | -------------------------------------------------------------------------------- /hachoir/bitarray/MANIFEST: -------------------------------------------------------------------------------- 1 | AUTHORS 2 | CHANGE_LOG 3 | LICENSE 4 | MANIFEST 5 | README 6 | README.html 7 | TODO 8 | setup.py 9 | bitarray/__init__.py 10 | bitarray/_bitarray.c 11 | bitarray/test_bitarray.py 12 | examples/README 13 | examples/decoding.py 14 | examples/huffman.py 15 | examples/mandel.py 16 | examples/ndarray.py 17 | examples/pbm.py 18 | examples/smallints.py 19 | -------------------------------------------------------------------------------- /hachoir/bitarray/TODO: -------------------------------------------------------------------------------- 1 | 2 | * Write special tests for really large bitarrays, for which the length 3 | exceeds 2**31 bits 4 | 5 | -------------------------------------------------------------------------------- /hachoir/bitarray/build/lib.linux-x86_64-2.7/bitarray/_bitarray.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/bitarray/build/lib.linux-x86_64-2.7/bitarray/_bitarray.so -------------------------------------------------------------------------------- /hachoir/bitarray/build/temp.linux-x86_64-2.7/bitarray/_bitarray.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/bitarray/build/temp.linux-x86_64-2.7/bitarray/_bitarray.o -------------------------------------------------------------------------------- /hachoir/bitarray/examples/ndarray.py: -------------------------------------------------------------------------------- 1 | # 2 | # This example illusatrates how binary data can be efficiently be passed 3 | # between a bitarray object and an ndarray with dtype bool 4 | # 5 | import bitarray 6 | import numpy 7 | 8 | a = bitarray.bitarray('100011001001') 9 | print a 10 | 11 | # bitarray -> ndarray 12 | b = numpy.fromstring(a.unpack(), dtype=bool) 13 | print repr(b) 14 | 15 | # ndarray -> bitarray 16 | c = bitarray.bitarray() 17 | c.pack(b.tostring()) 18 | 19 | assert a == c 20 | 21 | -------------------------------------------------------------------------------- /hachoir/coverage_test.py: -------------------------------------------------------------------------------- 1 | """ 2 | Run the maximum of tests to have good coverage test. 3 | """ 4 | 5 | import os 6 | import imp 7 | 8 | def main(): 9 | import doctest, pdb 10 | if doctest._OutputRedirectingPdb.set_trace == pdb.Pdb.set_trace: 11 | raise ImportError("Your doctest version is too old") 12 | 13 | directory = os.getenv("TESTCASE") 14 | if not directory: 15 | home = os.getenv("HOME") 16 | assert home 17 | directory = os.path.join(home, "testcase") 18 | 19 | parser = imp.load_source("parser", "hachoir-parser/tests/run_testcase.py") 20 | parser.testRandom() 21 | parser.testFiles(directory) 22 | 23 | metadata = imp.load_source("metadata", "hachoir-metadata/run_testcase.py") 24 | metadata.testFiles(directory) 25 | 26 | core_doc = imp.load_source("parser", "hachoir-core/test_doc.py") 27 | core_doc.main() 28 | 29 | metadata_doc = imp.load_source("parser", "hachoir-metadata/test_doc.py") 30 | metadata_doc.main() 31 | 32 | if __name__ == "__main__": 33 | main() 34 | 35 | -------------------------------------------------------------------------------- /hachoir/coverage_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Use Olivier Grisel "trace2html" tool to do coverage test 4 | # Create HTML report in coverage_report/ directory 5 | # 6 | # http://cheeseshop.python.org/pypi/trace2html 7 | 8 | trace2html.py -w hachoir_core -w hachoir_parser -w hachoir_metadata -o coverage_report --run-command coverage_test.py 9 | -------------------------------------------------------------------------------- /hachoir/hachoir-core/AUTHORS: -------------------------------------------------------------------------------- 1 | * Team 2 | 3 | Julien Muchembled 4 | Victor Stinner aka haypo 5 | Robert Xiao aka nneonneo - improve SeekableFieldSet 6 | 7 | * Packagers 8 | 9 | Arnaud Pithon aka bildoon - ArchLinux package (v0.5.2 and svn) 10 | Emmanuel GARETTE aka GnunuX - ArchLinux package (v0.5.2) 11 | Michael Scherer aka misc - Mandriva package (v0.5.2) 12 | Michel Casabona aka plumbear - Debian package (v0.5.2) 13 | Richard DEMONGEOT - Debian package (v0.5.2) 14 | Thomas de Grenier de Latour TGL - Gentoo ebuild 15 | 16 | -------------------------------------------------------------------------------- /hachoir/hachoir-core/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include AUTHORS 2 | include ChangeLog 3 | include COPYING 4 | include doc/adding_fields.graphviz 5 | include doc/*.css 6 | include doc/*.dia 7 | include doc/*.rst 8 | include doc/*.xmi 9 | include MANIFEST.in 10 | include test_doc.py 11 | -------------------------------------------------------------------------------- /hachoir/hachoir-core/doc/adding_fields.graphviz: -------------------------------------------------------------------------------- 1 | digraph GenericFieldSet { 2 | rankdir=LR; 3 | { 4 | node [shape=box]; 5 | StopIteration [ color=green ]; 6 | FieldError [ color=red, rank=max ]; 7 | ParserError -> FieldError; 8 | }; 9 | 10 | _addField -> { _setUniqFieldName _fixFieldSize }; 11 | readFirstFields -> readMoreFields; 12 | { _stopFeeding _fixFeedError } -> _fixLastField -> _deleteField; 13 | { __iter__ _feedAll readMoreFields _feedUntil } 14 | -> _addField; 15 | { __iter__ _feedAll readMoreFields _feedUntil } 16 | -> _stopFeeding [ color=green ]; 17 | { __iter__ _feedAll readMoreFields _feedUntil } 18 | -> { _fixFeedError FieldError } [ color=red ]; 19 | 20 | { _addField _stopFeeding } -> ParserError; 21 | _fixFieldSize -> StopIteration; 22 | 23 | { __len__ _getSize } -> _feedAll; 24 | _getField -> _feedUntil; 25 | } 26 | -------------------------------------------------------------------------------- /hachoir/hachoir-core/hachoir_core/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_core.version import VERSION as __version__, PACKAGE, WEBSITE, LICENSE 2 | 3 | -------------------------------------------------------------------------------- /hachoir/hachoir-core/hachoir_core/config.py: -------------------------------------------------------------------------------- 1 | """ 2 | Configuration of Hachoir 3 | """ 4 | 5 | import os 6 | 7 | # UI: display options 8 | max_string_length = 40 # Max. length in characters of GenericString.display 9 | max_byte_length = 14 # Max. length in bytes of RawBytes.display 10 | max_bit_length = 256 # Max. length in bits of RawBits.display 11 | unicode_stdout = True # Replace stdout and stderr with Unicode compatible objects 12 | # Disable it for readline or ipython 13 | 14 | # Global options 15 | debug = False # Display many informations usefull to debug 16 | verbose = False # Display more informations 17 | quiet = False # Don't display warnings 18 | 19 | # Use internationalization and localization (gettext)? 20 | if os.name == "nt": 21 | # TODO: Remove this hack and make i18n works on Windows :-) 22 | use_i18n = False 23 | else: 24 | use_i18n = True 25 | 26 | # Parser global options 27 | autofix = True # Enable Autofix? see hachoir_core.field.GenericFieldSet 28 | check_padding_pattern = True # Check padding fields pattern? 29 | 30 | -------------------------------------------------------------------------------- /hachoir/hachoir-core/hachoir_core/endian.py: -------------------------------------------------------------------------------- 1 | """ 2 | Constant values about endian. 3 | """ 4 | 5 | from hachoir_core.i18n import _ 6 | 7 | BIG_ENDIAN = "ABCD" 8 | LITTLE_ENDIAN = "DCBA" 9 | MIDDLE_ENDIAN = "BADC" 10 | NETWORK_ENDIAN = BIG_ENDIAN 11 | 12 | endian_name = { 13 | BIG_ENDIAN: _("Big endian"), 14 | LITTLE_ENDIAN: _("Little endian"), 15 | MIDDLE_ENDIAN: _("Middle endian"), 16 | } 17 | -------------------------------------------------------------------------------- /hachoir/hachoir-core/hachoir_core/event_handler.py: -------------------------------------------------------------------------------- 1 | class EventHandler(object): 2 | """ 3 | Class to connect events to event handlers. 4 | """ 5 | 6 | def __init__(self): 7 | self.handlers = {} 8 | 9 | def connect(self, event_name, handler): 10 | """ 11 | Connect an event handler to an event. Append it to handlers list. 12 | """ 13 | try: 14 | self.handlers[event_name].append(handler) 15 | except KeyError: 16 | self.handlers[event_name] = [handler] 17 | 18 | def raiseEvent(self, event_name, *args): 19 | """ 20 | Raiser an event: call each handler for this event_name. 21 | """ 22 | if event_name not in self.handlers: 23 | return 24 | for handler in self.handlers[event_name]: 25 | handler(*args) 26 | 27 | -------------------------------------------------------------------------------- /hachoir/hachoir-core/hachoir_core/field/character.py: -------------------------------------------------------------------------------- 1 | """ 2 | Character field class: a 8-bit character 3 | """ 4 | 5 | from hachoir_core.field import Bits 6 | from hachoir_core.endian import BIG_ENDIAN 7 | from hachoir_core.tools import makePrintable 8 | 9 | class Character(Bits): 10 | """ 11 | A 8-bit character using ASCII charset for display attribute. 12 | """ 13 | static_size = 8 14 | 15 | def __init__(self, parent, name, description=None): 16 | Bits.__init__(self, parent, name, 8, description=description) 17 | 18 | def createValue(self): 19 | return chr(self._parent.stream.readBits( 20 | self.absolute_address, 8, BIG_ENDIAN)) 21 | 22 | def createRawDisplay(self): 23 | return unicode(Bits.createValue(self)) 24 | 25 | def createDisplay(self): 26 | return makePrintable(self.value, "ASCII", quote="'", to_unicode=True) 27 | -------------------------------------------------------------------------------- /hachoir/hachoir-core/hachoir_core/field/enum.py: -------------------------------------------------------------------------------- 1 | def Enum(field, enum, key_func=None): 2 | """ 3 | Enum is an adapter to another field: it will just change its display 4 | attribute. It uses a dictionary to associate a value to another. 5 | 6 | key_func is an optional function with prototype "def func(key)->key" 7 | which is called to transform key. 8 | """ 9 | display = field.createDisplay 10 | if key_func: 11 | def createDisplay(): 12 | try: 13 | key = key_func(field.value) 14 | return enum[key] 15 | except LookupError: 16 | return display() 17 | else: 18 | def createDisplay(): 19 | try: 20 | return enum[field.value] 21 | except LookupError: 22 | return display() 23 | field.createDisplay = createDisplay 24 | field.getEnum = lambda: enum 25 | return field 26 | -------------------------------------------------------------------------------- /hachoir/hachoir-core/hachoir_core/field/field_set.py: -------------------------------------------------------------------------------- 1 | from hachoir_core.field import BasicFieldSet, GenericFieldSet 2 | 3 | class FieldSet(GenericFieldSet): 4 | def __init__(self, parent, name, *args, **kw): 5 | assert issubclass(parent.__class__, BasicFieldSet) 6 | GenericFieldSet.__init__(self, parent, name, parent.stream, *args, **kw) 7 | 8 | -------------------------------------------------------------------------------- /hachoir/hachoir-core/hachoir_core/language.py: -------------------------------------------------------------------------------- 1 | from hachoir_core.iso639 import ISO639_2 2 | 3 | class Language: 4 | def __init__(self, code): 5 | code = str(code) 6 | if code not in ISO639_2: 7 | raise ValueError("Invalid language code: %r" % code) 8 | self.code = code 9 | 10 | def __cmp__(self, other): 11 | if other.__class__ != Language: 12 | return 1 13 | return cmp(self.code, other.code) 14 | 15 | def __unicode__(self): 16 | return ISO639_2[self.code] 17 | 18 | def __str__(self): 19 | return self.__unicode__() 20 | 21 | def __repr__(self): 22 | return "" % (unicode(self), self.code) 23 | 24 | -------------------------------------------------------------------------------- /hachoir/hachoir-core/hachoir_core/profiler.py: -------------------------------------------------------------------------------- 1 | from hotshot import Profile 2 | from hotshot.stats import load as loadStats 3 | from os import unlink 4 | 5 | def runProfiler(func, args=tuple(), kw={}, verbose=True, nb_func=25, sort_by=('cumulative', 'calls')): 6 | profile_filename = "/tmp/profiler" 7 | prof = Profile(profile_filename) 8 | try: 9 | if verbose: 10 | print "[+] Run profiler" 11 | result = prof.runcall(func, *args, **kw) 12 | prof.close() 13 | if verbose: 14 | print "[+] Stop profiler" 15 | print "[+] Process data..." 16 | stat = loadStats(profile_filename) 17 | if verbose: 18 | print "[+] Strip..." 19 | stat.strip_dirs() 20 | if verbose: 21 | print "[+] Sort data..." 22 | stat.sort_stats(*sort_by) 23 | if verbose: 24 | print 25 | print "[+] Display statistics" 26 | print 27 | stat.print_stats(nb_func) 28 | return result 29 | finally: 30 | unlink(profile_filename) 31 | 32 | -------------------------------------------------------------------------------- /hachoir/hachoir-core/hachoir_core/stream/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_core.endian import BIG_ENDIAN, LITTLE_ENDIAN 2 | from hachoir_core.stream.stream import StreamError 3 | from hachoir_core.stream.input import ( 4 | InputStreamError, 5 | InputStream, InputIOStream, StringInputStream, 6 | InputSubStream, InputFieldStream, 7 | FragmentedStream, ConcatStream) 8 | from hachoir_core.stream.input_helper import FileInputStream, guessStreamCharset 9 | from hachoir_core.stream.output import (OutputStreamError, 10 | FileOutputStream, StringOutputStream, OutputStream) 11 | 12 | -------------------------------------------------------------------------------- /hachoir/hachoir-core/hachoir_core/stream/stream.py: -------------------------------------------------------------------------------- 1 | from hachoir_core.error import HachoirError 2 | 3 | class StreamError(HachoirError): 4 | pass 5 | 6 | -------------------------------------------------------------------------------- /hachoir/hachoir-core/hachoir_core/version.py: -------------------------------------------------------------------------------- 1 | PACKAGE = "hachoir-core" 2 | VERSION = "1.3.4" 3 | WEBSITE = 'http://bitbucket.org/haypo/hachoir/wiki/hachoir-core' 4 | LICENSE = 'GNU GPL v2' 5 | 6 | -------------------------------------------------------------------------------- /hachoir/hachoir-editor/AUTHORS: -------------------------------------------------------------------------------- 1 | Victor Stinner aka haypo 2 | 3 | -------------------------------------------------------------------------------- /hachoir/hachoir-editor/README: -------------------------------------------------------------------------------- 1 | Hachoir editor 2 | ============== 3 | 4 | Hachoir core is a Python library based on Hachoir core used to edit binary 5 | files. 6 | 7 | Website: http://bitbucket.org/haypo/hachoir/wiki/ 8 | 9 | -------------------------------------------------------------------------------- /hachoir/hachoir-editor/hachoir_editor/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_editor.field import ( 2 | EditorError, FakeField) 3 | from hachoir_editor.typed_field import ( 4 | EditableField, EditableBits, EditableBytes, 5 | EditableInteger, EditableString, 6 | createEditableField) 7 | from hachoir_editor.fieldset import EditableFieldSet, NewFieldSet, createEditor 8 | 9 | -------------------------------------------------------------------------------- /hachoir/hachoir-gtk/AUTHORS: -------------------------------------------------------------------------------- 1 | Mathieu Stumpf 2 | Victor Stinner 3 | 4 | -------------------------------------------------------------------------------- /hachoir/hachoir-http/AUTHORS: -------------------------------------------------------------------------------- 1 | Robert Xiao aka nneonneo 2 | 3 | -------------------------------------------------------------------------------- /hachoir/hachoir-http/README: -------------------------------------------------------------------------------- 1 | hachoir-client.js and hachoir-style.css go in the root of the server, or 2 | else update the links in cgi-bin/hachoir.py to match. hachoir.py goes in 3 | the /cgi-bin/ folder, though it can basically go anywhere where CGI 4 | execution is enabled (it does not rely on cgi-bin being the parent folder). 5 | -------------------------------------------------------------------------------- /hachoir/hachoir-metadata/AUTHORS: -------------------------------------------------------------------------------- 1 | Elie Roudninski aka adema - Started Gtk GUI 2 | Feth Arezki - Fix hachoir-metadata-qt to save the current directory 3 | Jean-Marc Libs - KDE plugin 4 | Pierre THIERRY - KDE plugin 5 | Thomas PABST - Gnome plugin 6 | Victor Stinner aka haypo - Metadata core 7 | 8 | -------------------------------------------------------------------------------- /hachoir/hachoir-metadata/INSTALL: -------------------------------------------------------------------------------- 1 | Dependencies 2 | ============ 3 | 4 | hachoir-metadata: 5 | * hachoir-core 1.3 6 | * hachoir-parser 1.3 7 | 8 | hachoir-metadata-gtk: 9 | * pygtk (Debian package: python-gtk2) 10 | 11 | hachoir-metadata-qt: 12 | * PyQt4 13 | 14 | To compile hachoir_metadata/qt/dialog.ui, you need pyuic4 which is part of 15 | PyQt4 development tools. 16 | 17 | 18 | Install 19 | ======= 20 | 21 | Run the follow command as root: :: 22 | 23 | ./setup.py install 24 | 25 | -------------------------------------------------------------------------------- /hachoir/hachoir-metadata/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include AUTHORS 2 | include ChangeLog 3 | include COPYING 4 | include gnome/hachoir 5 | include gnome/README 6 | include hachoir_metadata/qt/dialog.ui 7 | include INSTALL 8 | include kde/hachoir.desktop 9 | include kde/hachoir-metadata-kde 10 | include kde/README 11 | include MANIFEST.in 12 | include metadata_csv.py 13 | include README 14 | include run_testcase.py 15 | include test_doc.py 16 | -------------------------------------------------------------------------------- /hachoir/hachoir-metadata/gnome/README: -------------------------------------------------------------------------------- 1 | Nautilus hachoir-metadata plugin. 2 | 3 | Installation 4 | ============ 5 | 6 | To install it, just copy "hachoir" file into directory: 7 | ~/.gnome2/nautilus-scripts/ 8 | 9 | Dependencies 10 | ============ 11 | 12 | * gdialog 13 | 14 | -------------------------------------------------------------------------------- /hachoir/hachoir-metadata/gnome/hachoir: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | TMP_FILE=$(mktemp /tmp/hachoir-metadataXXXXXX) 4 | 5 | hachoir-metadata "$1" > $TMP_FILE 6 | NBR_LIGNES=$(wc -l $TMP_FILE | cut -d " " -f 1) 7 | 8 | X=$(($NBR_LIGNES/3+2)) 9 | if [ $X -gt 10 ] 10 | then HIGHT_WINDOWS=100 11 | else 12 | if [[ $X -gt 3 && $X -lt 11 ]] 13 | then HIGHT_WINDOWS=$((X*10)) 14 | else 15 | HIGHT_WINDOWS=20 16 | fi 17 | fi 18 | 19 | NBR_MAX_CHAR=$(wc -L $TMP_FILE | cut -d " " -f 1) 20 | 21 | if [ ${NBR_MAX_CHAR} -lt 10 ] 22 | then WIDTH_WINDOWS=20 23 | else 24 | if [ ${NBR_MAX_CHAR} -lt 100 ] 25 | then WIDTH_WINDOWS=160 26 | else 27 | WIDTH_WINDOWS=$(( ( ${NBR_MAX_CHAR} * 15 ) / 13 )) 28 | fi 29 | fi 30 | 31 | gdialog --title "$1" --textbox $TMP_FILE $HIGHT_WINDOWS $WIDTH_WINDOWS 32 | 33 | rm $TMP_FILE 34 | 35 | -------------------------------------------------------------------------------- /hachoir/hachoir-metadata/hachoir_metadata/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_metadata.version import VERSION as __version__ 2 | from hachoir_metadata.metadata import extractMetadata 3 | 4 | # Just import the module, 5 | # each module use registerExtractor() method 6 | import hachoir_metadata.archive 7 | import hachoir_metadata.audio 8 | import hachoir_metadata.file_system 9 | import hachoir_metadata.image 10 | import hachoir_metadata.jpeg 11 | import hachoir_metadata.misc 12 | import hachoir_metadata.program 13 | import hachoir_metadata.riff 14 | import hachoir_metadata.video 15 | 16 | -------------------------------------------------------------------------------- /hachoir/hachoir-metadata/hachoir_metadata/config.py: -------------------------------------------------------------------------------- 1 | MAX_STR_LENGTH = 300 # characters 2 | RAW_OUTPUT = False 3 | -------------------------------------------------------------------------------- /hachoir/hachoir-metadata/hachoir_metadata/formatter.py: -------------------------------------------------------------------------------- 1 | from hachoir_core.i18n import _, ngettext 2 | 3 | NB_CHANNEL_NAME = {1: _("mono"), 2: _("stereo")} 4 | 5 | def humanAudioChannel(value): 6 | return NB_CHANNEL_NAME.get(value, unicode(value)) 7 | 8 | def humanFrameRate(value): 9 | if isinstance(value, (int, long, float)): 10 | return _("%.1f fps") % value 11 | else: 12 | return value 13 | 14 | def humanComprRate(rate): 15 | return u"%.1fx" % rate 16 | 17 | def humanAltitude(value): 18 | return ngettext("%.1f meter", "%.1f meters", value) % value 19 | 20 | def humanPixelSize(value): 21 | return ngettext("%s pixel", "%s pixels", value) % value 22 | 23 | def humanDPI(value): 24 | return u"%s DPI" % value 25 | 26 | -------------------------------------------------------------------------------- /hachoir/hachoir-metadata/hachoir_metadata/qt/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-metadata/hachoir_metadata/qt/__init__.py -------------------------------------------------------------------------------- /hachoir/hachoir-metadata/hachoir_metadata/safe.py: -------------------------------------------------------------------------------- 1 | from hachoir_core.error import HACHOIR_ERRORS, warning 2 | 3 | def fault_tolerant(func, *args): 4 | def safe_func(*args, **kw): 5 | try: 6 | func(*args, **kw) 7 | except HACHOIR_ERRORS, err: 8 | warning("Error when calling function %s(): %s" % ( 9 | func.__name__, err)) 10 | return safe_func 11 | 12 | def getFieldAttribute(fieldset, key, attrname): 13 | try: 14 | field = fieldset[key] 15 | if field.hasValue(): 16 | return getattr(field, attrname) 17 | except HACHOIR_ERRORS, err: 18 | warning("Unable to get %s of field %s/%s: %s" % ( 19 | attrname, fieldset.path, key, err)) 20 | return None 21 | 22 | def getValue(fieldset, key): 23 | return getFieldAttribute(fieldset, key, "value") 24 | 25 | def getDisplay(fieldset, key): 26 | return getFieldAttribute(fieldset, key, "display") 27 | 28 | -------------------------------------------------------------------------------- /hachoir/hachoir-metadata/hachoir_metadata/timezone.py: -------------------------------------------------------------------------------- 1 | from datetime import tzinfo, timedelta 2 | 3 | class TimezoneUTC(tzinfo): 4 | """UTC timezone""" 5 | ZERO = timedelta(0) 6 | 7 | def utcoffset(self, dt): 8 | return TimezoneUTC.ZERO 9 | 10 | def tzname(self, dt): 11 | return u"UTC" 12 | 13 | def dst(self, dt): 14 | return TimezoneUTC.ZERO 15 | 16 | def __repr__(self): 17 | return "" 18 | 19 | class Timezone(TimezoneUTC): 20 | """Fixed offset in hour from UTC.""" 21 | def __init__(self, offset): 22 | self._offset = timedelta(minutes=offset*60) 23 | self._name = u"%+03u00" % offset 24 | 25 | def utcoffset(self, dt): 26 | return self._offset 27 | 28 | def tzname(self, dt): 29 | return self._name 30 | 31 | def __repr__(self): 32 | return "" % ( 33 | self._offset, self._name) 34 | 35 | UTC = TimezoneUTC() 36 | 37 | def createTimezone(offset): 38 | if offset: 39 | return Timezone(offset) 40 | else: 41 | return UTC 42 | 43 | -------------------------------------------------------------------------------- /hachoir/hachoir-metadata/hachoir_metadata/version.py: -------------------------------------------------------------------------------- 1 | PACKAGE = "hachoir-metadata" 2 | VERSION = "1.3.3" 3 | WEBSITE = "http://bitbucket.org/haypo/hachoir/wiki/hachoir-metadata" 4 | LICENSE = "GNU GPL v2" 5 | 6 | -------------------------------------------------------------------------------- /hachoir/hachoir-metadata/kde/README: -------------------------------------------------------------------------------- 1 | Usage 2 | ===== 3 | 4 | The hachoir.desktop file goes in: 5 | /usr/share/apps/konqueror/servicemenus 6 | 7 | The hachoir-metadata-kde goes in: 8 | /usr/bin 9 | (or anywhere in the PATH) 10 | 11 | Effect 12 | ====== 13 | 14 | When right-clicking on any file in konqueror, produces a "hachoir metadata" 15 | entry under "Actions" menu. This produces a pop-up which displays the file's 16 | metadata. 17 | 18 | Optional 19 | ======== 20 | 21 | Replace 22 | 23 | Exec=kdialog --passivepopup "`hachoir-metadata %F`" 30 --title "%N" --caption "%c" 24 | 25 | with 26 | 27 | Exec=echo " " > /tmp/hachoir.tmp || exit; hachoir-metadata-kde %F > /tmp/hachoir.tmp; kdialog --textbox /tmp/hachoir.tmp 500 600 --title "%N" --caption "%c"; unlink /tmp/hachoir.tmp 28 | 29 | for a real kdialog pop-up 30 | 31 | -------------------------------------------------------------------------------- /hachoir/hachoir-metadata/kde/hachoir-metadata-kde: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for i in "$@" 4 | do 5 | echo "File: '$i'" 6 | hachoir-metadata "$i" 7 | echo " " 8 | done 9 | 10 | -------------------------------------------------------------------------------- /hachoir/hachoir-metadata/kde/hachoir.desktop: -------------------------------------------------------------------------------- 1 | # hachoir.desktop, by Jean-Marc Libs 2 | # 3 | 4 | [Desktop Entry] 5 | ServiceTypes=all/allfiles 6 | TryExec=kdialog 7 | TryExec=hachoir-metadata 8 | Actions=Hachoir 9 | X-KDE-Priority=TopLevel 10 | 11 | [Desktop Action Hachoir] 12 | Name=Hachoir metadata 13 | Icon=info 14 | #Exec=kdialog --passivepopup "`hachoir-metadata %F`" 30 --title "%N" --caption "%c" 15 | # Other possibility: 16 | Exec=echo " " > /tmp/hachoir.tmp || exit; hachoir-metadata-kde %F > /tmp/hachoir.tmp; kdialog --textbox /tmp/hachoir.tmp 500 600 --title "%N" --caption "%c"; unlink /tmp/hachoir.tmp 17 | #Exec=kdialog --msgbox "`hachoir-metadata %f`" --title "%n" --caption "%c" 18 | Name[fr]=Méta-données hachoir 19 | Name[de]=Hachoir-Metadaten 20 | 21 | -------------------------------------------------------------------------------- /hachoir/hachoir-metadata/test_doc.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2.4 2 | import doctest 3 | import sys 4 | 5 | def importModule(name): 6 | mod = __import__(name) 7 | components = name.split('.') 8 | for comp in components[1:]: 9 | mod = getattr(mod, comp) 10 | return mod 11 | 12 | def testModule(name): 13 | print "--- Test module %s" % name 14 | module = importModule(name) 15 | failure, nb_test = doctest.testmod(module) 16 | if failure: 17 | sys.exit(1) 18 | print "--- End of test" 19 | 20 | def main(): 21 | # Configure Hachoir for tests 22 | import hachoir_core.config as config 23 | config.use_i18n = False 24 | 25 | # Test documentation of some functions/classes 26 | testModule("hachoir_metadata.metadata") 27 | testModule("hachoir_metadata.setter") 28 | 29 | if __name__ == "__main__": 30 | main() 31 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/INSTALL: -------------------------------------------------------------------------------- 1 | Dependencies 2 | ============ 3 | 4 | hachoir-parser: 5 | * hachoir-core 1.3 6 | 7 | 8 | Install 9 | ======= 10 | 11 | Run the follow command as root: :: 12 | 13 | ./setup.py install 14 | 15 | 16 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include AUTHORS 2 | include ChangeLog 3 | include COPYING 4 | include INSTALL 5 | include MANIFEST.in 6 | include metadata_csv.py 7 | include README 8 | include README.header 9 | include README.py 10 | include tests/download_testcase.py 11 | include tests/run_testcase.py 12 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/README.header: -------------------------------------------------------------------------------- 1 | hachoir-parser is a package of most common file format parsers written for 2 | Hachoir framework. Not all parsers are complete, some are very good and other 3 | are poor: only parser first level of the tree for example. 4 | 5 | A perfect parser have no "raw" field: with a perfect parser you are able to 6 | know *each* bit meaning. Some good (but not perfect ;-)) parsers: 7 | 8 | * Matroska video 9 | * Microsoft RIFF (AVI video, WAV audio, CDA file) 10 | * PNG picture 11 | * TAR and ZIP archive 12 | 13 | GnomeKeyring parser requires Python Crypto module: 14 | http://www.amk.ca/python/code/crypto.html 15 | 16 | Website: http://bitbucket.org/haypo/hachoir/wiki/hachoir-parser 17 | 18 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/README.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from __future__ import with_statement 3 | 4 | def writeReadme(out): 5 | from hachoir_parser.parser_list import HachoirParserList 6 | 7 | # Write header 8 | for line in open('README.header'): 9 | line = line.rstrip() 10 | print >>out, line 11 | if line: 12 | print >>out 13 | 14 | # Write changelog 15 | for line in open('ChangeLog'): 16 | line = line.rstrip() 17 | print >>out, line 18 | if line: 19 | print >>out 20 | 21 | # Write parser list 22 | format = "rest" 23 | if format == "rest": 24 | print >>out, "Parser list" 25 | print >>out, "===========" 26 | print >>out 27 | HachoirParserList().print_(out=out, format=format) 28 | 29 | def main(): 30 | with open('README', 'w') as readme: 31 | writeReadme(readme) 32 | print "README updated." 33 | 34 | if __name__ == "__main__": 35 | main() 36 | 37 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/hachoir_parser/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_parser.version import __version__ 2 | from hachoir_parser.parser import ValidateError, HachoirParser, Parser 3 | from hachoir_parser.parser_list import ParserList, HachoirParserList 4 | from hachoir_parser.guess import (QueryParser, guessParser, createParser) 5 | from hachoir_parser import (archive, audio, container, 6 | file_system, image, game, misc, network, program, video) 7 | 8 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/hachoir_parser/archive/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_parser.archive.ace import AceFile 2 | from hachoir_parser.archive.ar import ArchiveFile 3 | from hachoir_parser.archive.bzip2_parser import Bzip2Parser 4 | from hachoir_parser.archive.cab import CabFile 5 | from hachoir_parser.archive.gzip_parser import GzipParser 6 | from hachoir_parser.archive.tar import TarFile 7 | from hachoir_parser.archive.zip import ZipFile 8 | from hachoir_parser.archive.rar import RarFile 9 | from hachoir_parser.archive.rpm import RpmFile 10 | from hachoir_parser.archive.sevenzip import SevenZipParser 11 | from hachoir_parser.archive.mar import MarFile 12 | from hachoir_parser.archive.mozilla_ar import MozillaArchive 13 | from hachoir_parser.archive.zlib import ZlibData 14 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/hachoir_parser/audio/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_parser.audio.aiff import AiffFile 2 | from hachoir_parser.audio.au import AuFile 3 | from hachoir_parser.audio.itunesdb import ITunesDBFile 4 | from hachoir_parser.audio.midi import MidiFile 5 | from hachoir_parser.audio.mpeg_audio import MpegAudioFile 6 | from hachoir_parser.audio.real_audio import RealAudioFile 7 | from hachoir_parser.audio.xm import XMModule 8 | from hachoir_parser.audio.s3m import S3MModule 9 | from hachoir_parser.audio.s3m import PTMModule 10 | from hachoir_parser.audio.mod import AmigaModule 11 | from hachoir_parser.audio.flac import FlacParser 12 | 13 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/hachoir_parser/common/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-parser/hachoir_parser/common/__init__.py -------------------------------------------------------------------------------- /hachoir/hachoir-parser/hachoir_parser/common/deflate.py: -------------------------------------------------------------------------------- 1 | from hachoir_core.field import CompressedField 2 | 3 | try: 4 | from zlib import decompressobj, MAX_WBITS 5 | 6 | class DeflateStream: 7 | def __init__(self, stream, wbits=None): 8 | if wbits: 9 | self.gzip = decompressobj(-MAX_WBITS) 10 | else: 11 | self.gzip = decompressobj() 12 | 13 | def __call__(self, size, data=None): 14 | if data is None: 15 | data = '' 16 | return self.gzip.decompress(self.gzip.unconsumed_tail+data, size) 17 | 18 | class DeflateStreamWbits(DeflateStream): 19 | def __init__(self, stream): 20 | DeflateStream.__init__(self, stream, True) 21 | 22 | def Deflate(field, wbits=True): 23 | if wbits: 24 | CompressedField(field, DeflateStreamWbits) 25 | else: 26 | CompressedField(field, DeflateStream) 27 | return field 28 | has_deflate = True 29 | except ImportError: 30 | def Deflate(field, wbits=True): 31 | return field 32 | has_deflate = False 33 | 34 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/hachoir_parser/common/tracker.py: -------------------------------------------------------------------------------- 1 | """ 2 | Shared code for tracker parser. 3 | """ 4 | 5 | NOTE_NAME = {} 6 | NOTES = ("C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "G#", "A", "A#", "B") 7 | for octave in xrange(10): 8 | for index, note in enumerate(NOTES): 9 | NOTE_NAME[octave*12+index] = "%s (octave %s)" % (note, octave) 10 | 11 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/hachoir_parser/container/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_parser.container.asn1 import ASN1File 2 | from hachoir_parser.container.mkv import MkvFile 3 | from hachoir_parser.container.ogg import OggFile, OggStream 4 | from hachoir_parser.container.riff import RiffFile 5 | from hachoir_parser.container.swf import SwfFile 6 | from hachoir_parser.container.realmedia import RealMediaFile 7 | 8 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/hachoir_parser/file_system/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_parser.file_system.ext2 import EXT2_FS 2 | from hachoir_parser.file_system.fat import FAT12, FAT16, FAT32 3 | from hachoir_parser.file_system.mbr import MSDos_HardDrive 4 | from hachoir_parser.file_system.ntfs import NTFS 5 | from hachoir_parser.file_system.iso9660 import ISO9660 6 | from hachoir_parser.file_system.reiser_fs import REISER_FS 7 | from hachoir_parser.file_system.linux_swap import LinuxSwapFile 8 | 9 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/hachoir_parser/game/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_parser.game.zsnes import ZSNESFile 2 | from hachoir_parser.game.spider_man_video import SpiderManVideoFile 3 | from hachoir_parser.game.laf import LafFile 4 | from hachoir_parser.game.blp import BLP1File, BLP2File -------------------------------------------------------------------------------- /hachoir/hachoir-parser/hachoir_parser/image/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_parser.image.bmp import BmpFile 2 | from hachoir_parser.image.gif import GifFile 3 | from hachoir_parser.image.ico import IcoFile 4 | from hachoir_parser.image.jpeg import JpegFile 5 | from hachoir_parser.image.pcx import PcxFile 6 | from hachoir_parser.image.psd import PsdFile 7 | from hachoir_parser.image.png import PngFile 8 | from hachoir_parser.image.tga import TargaFile 9 | from hachoir_parser.image.tiff import TiffFile 10 | from hachoir_parser.image.wmf import WMF_File 11 | from hachoir_parser.image.xcf import XcfFile 12 | 13 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/hachoir_parser/misc/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_parser.misc.file_3do import File3do 2 | from hachoir_parser.misc.file_3ds import File3ds 3 | from hachoir_parser.misc.torrent import TorrentFile 4 | from hachoir_parser.misc.ttf import TrueTypeFontFile 5 | from hachoir_parser.misc.chm import ChmFile 6 | from hachoir_parser.misc.lnk import LnkFile 7 | from hachoir_parser.misc.pcf import PcfFile 8 | from hachoir_parser.misc.ole2 import OLE2_File 9 | from hachoir_parser.misc.pdf import PDFDocument 10 | from hachoir_parser.misc.pifv import PIFVFile 11 | from hachoir_parser.misc.hlp import HlpFile 12 | from hachoir_parser.misc.gnome_keyring import GnomeKeyring 13 | from hachoir_parser.misc.bplist import BPList 14 | from hachoir_parser.misc.dsstore import DSStore 15 | from hachoir_parser.misc.word_doc import WordDocumentParser 16 | from hachoir_parser.misc.word_2 import Word2DocumentParser 17 | from hachoir_parser.misc.mstask import MSTaskFile 18 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/hachoir_parser/misc/common.py: -------------------------------------------------------------------------------- 1 | from hachoir_core.field import StaticFieldSet, Float32 2 | 3 | class Vertex(StaticFieldSet): 4 | format = ((Float32, "x"), (Float32, "y"), (Float32, "z")) 5 | 6 | def createValue(self): 7 | return (self["x"].value, self["y"].value, self["z"].value) 8 | 9 | class MapUV(StaticFieldSet): 10 | format = ((Float32, "u"), (Float32, "v")) 11 | 12 | def createValue(self): 13 | return (self["u"].value, self["v"].value) 14 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/hachoir_parser/network/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_parser.network.tcpdump import TcpdumpFile 2 | 3 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/hachoir_parser/program/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_parser.program.elf import ElfFile 2 | from hachoir_parser.program.exe import ExeFile 3 | from hachoir_parser.program.python import PythonCompiledFile 4 | from hachoir_parser.program.java import JavaCompiledClassFile 5 | from hachoir_parser.program.prc import PRCFile 6 | 7 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/hachoir_parser/version.py: -------------------------------------------------------------------------------- 1 | __version__ = "1.3.5" 2 | PACKAGE = "hachoir-parser" 3 | WEBSITE = "http://bitbucket.org/haypo/hachoir/wiki/hachoir-parser" 4 | LICENSE = 'GNU GPL v2' 5 | 6 | -------------------------------------------------------------------------------- /hachoir/hachoir-parser/hachoir_parser/video/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_parser.video.asf import AsfFile 2 | from hachoir_parser.video.flv import FlvFile 3 | from hachoir_parser.video.mov import MovFile 4 | from hachoir_parser.video.mpeg_video import MPEGVideoFile 5 | from hachoir_parser.video.mpeg_ts import MPEG_TS 6 | 7 | -------------------------------------------------------------------------------- /hachoir/hachoir-regex/AUTHORS: -------------------------------------------------------------------------------- 1 | Victor Stinner aka haypo 2 | 3 | -------------------------------------------------------------------------------- /hachoir/hachoir-regex/INSTALL: -------------------------------------------------------------------------------- 1 | Install 2 | ======= 3 | 4 | Run the follow command as root: :: 5 | 6 | ./setup.py install 7 | 8 | -------------------------------------------------------------------------------- /hachoir/hachoir-regex/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include AUTHORS 2 | include COPYING 3 | include INSTALL 4 | include MANIFEST.in 5 | include README 6 | include *.rst 7 | include test_doc.py 8 | -------------------------------------------------------------------------------- /hachoir/hachoir-regex/hachoir_regex/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_regex.regex import (RegexEmpty, 2 | RegexString, createString, 3 | RegexRangeItem, RegexRangeCharacter, RegexRange, createRange, 4 | RegexAnd, RegexOr, RegexRepeat, 5 | RegexDot, RegexStart, RegexEnd, RegexWord) 6 | from hachoir_regex.parser import parse 7 | from hachoir_regex.pattern import PatternMatching 8 | 9 | -------------------------------------------------------------------------------- /hachoir/hachoir-regex/hachoir_regex/compatibility.py: -------------------------------------------------------------------------------- 1 | """ 2 | Compatibility functions for old version of Python. 3 | 4 | any() function 5 | ============== 6 | 7 | any() returns True if at least one items is True, or False otherwise. 8 | 9 | >>> any([False, True]) 10 | True 11 | >>> any([True, True]) 12 | True 13 | >>> any([False, False]) 14 | False 15 | 16 | 17 | all() function 18 | ============== 19 | 20 | all() returns True if all items are True, or False otherwise. 21 | This function is just apply binary and operator (&) on all values. 22 | 23 | >>> all([True, True]) 24 | True 25 | >>> all([False, True]) 26 | False 27 | >>> all([False, False]) 28 | False 29 | """ 30 | import operator 31 | 32 | # --- any() from Python 2.5 --- 33 | try: 34 | from __builtin__ import any 35 | except ImportError: 36 | def any(items): 37 | for item in items: 38 | if item: 39 | return True 40 | return False 41 | 42 | # ---all() from Python 2.5 --- 43 | try: 44 | from __builtin__ import all 45 | except ImportError: 46 | def all(items): 47 | return reduce(operator.__and__, items) 48 | 49 | __all__ = ("any", "all") 50 | 51 | -------------------------------------------------------------------------------- /hachoir/hachoir-regex/hachoir_regex/version.py: -------------------------------------------------------------------------------- 1 | __version__ = "1.0.5" 2 | PACKAGE = "hachoir-regex" 3 | WEBSITE = "http://bitbucket.org/haypo/hachoir/wiki/hachoir-regex" 4 | LICENSE = 'GNU GPL v2' 5 | 6 | -------------------------------------------------------------------------------- /hachoir/hachoir-subfile/AUTHORS: -------------------------------------------------------------------------------- 1 | Victor Stinner aka haypo 2 | 3 | -------------------------------------------------------------------------------- /hachoir/hachoir-subfile/hachoir_subfile/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-subfile/hachoir_subfile/__init__.py -------------------------------------------------------------------------------- /hachoir/hachoir-subfile/hachoir_subfile/version.py: -------------------------------------------------------------------------------- 1 | VERSION = "0.5.3" 2 | PACKAGE = "hachoir-subfile" 3 | WEBSITE = "http://bitbucket.org/haypo/hachoir/wiki/hachoir-subfile" 4 | LICENSE = 'GNU GPL v2' 5 | 6 | 7 | -------------------------------------------------------------------------------- /hachoir/hachoir-tools/AUTHORS: -------------------------------------------------------------------------------- 1 | Victor Stinner aka haypo 2 | 3 | -------------------------------------------------------------------------------- /hachoir/hachoir-tools/download_random/sort_by_filext.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | dbdir="filedb" 4 | 5 | if [ "x$1" = "x" ]; then 6 | echo "usage: $0 directory" 7 | exit 1 8 | fi 9 | 10 | echo "Sort files from $1" 11 | 12 | for ext in bmp jpg png gif; do 13 | dir=$dbdir/$ext 14 | mkdir -p $dir 15 | mv $1/*.$ext $dir 16 | done 17 | 18 | echo "done" 19 | 20 | -------------------------------------------------------------------------------- /hachoir/hachoir-tools/download_random/webgobbler/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | total = 100 4 | directory = "imagepool" 5 | 6 | from webgobbler import imagePool, applicationConfig 7 | from time import sleep 8 | 9 | config = applicationConfig() 10 | config["pool.keepimages"] = True 11 | config["pool.imagepooldirectory"] = directory 12 | config["pool.nbimages"] = total 13 | pool = imagePool(config=config) 14 | try: 15 | try: 16 | pool.start() 17 | count = 0 18 | while True: 19 | image = pool.getImage() 20 | if image: 21 | count += 1 22 | print "Downloaded: %s/%s" % (count, total) 23 | if total <= count: 24 | break 25 | else: 26 | sleep(1.0) 27 | except KeyboardInterrupt: 28 | print "Interrupt." 29 | finally: 30 | print "Stopping image pool (please wait)." 31 | pool.shutdown() 32 | pool.join() 33 | 34 | 35 | -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-04dc6a047cb099bc1b1c532f50e228441d801218-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-04dc6a047cb099bc1b1c532f50e228441d801218-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-0dba4144634e5254cce16e1ee3ea0867eefe6586-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-0dba4144634e5254cce16e1ee3ea0867eefe6586-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-133a887861ea8222c08bf55343c015ced27f5538-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-133a887861ea8222c08bf55343c015ced27f5538-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-14a8f0f3069f85d01d34dd3e85fa262eb410b25b-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-14a8f0f3069f85d01d34dd3e85fa262eb410b25b-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-1adf3c0ef3fb9bb2cfcc657837761725ae70fe4c-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-1adf3c0ef3fb9bb2cfcc657837761725ae70fe4c-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-2318e1767ef3b1ea60cd63b6730b401bef735964-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-2318e1767ef3b1ea60cd63b6730b401bef735964-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-289ba035198c090177cedc1326731c099315f5fd-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-289ba035198c090177cedc1326731c099315f5fd-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-3a3dd3881b729b5cdde6f19ee2340d01583c5276-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-3a3dd3881b729b5cdde6f19ee2340d01583c5276-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-3cc7a2d89c990d65b4518c07fd632ed5fb844d25-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-3cc7a2d89c990d65b4518c07fd632ed5fb844d25-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-41540bda885d32d8aef5b4dd5cca80f6e8e69f37-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-41540bda885d32d8aef5b4dd5cca80f6e8e69f37-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-4819e08fb723c299fe9ec7c92c89548c9236a0fd-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-4819e08fb723c299fe9ec7c92c89548c9236a0fd-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-4f8aab01747e6024c735bba6f5ed1f5d0c0bec74-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-4f8aab01747e6024c735bba6f5ed1f5d0c0bec74-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-5073d41e77cd82d66399ec6270ade46052010516-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-5073d41e77cd82d66399ec6270ade46052010516-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-5102918635e3d2fd7e2d1a288d5ed6e1024ca595-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-5102918635e3d2fd7e2d1a288d5ed6e1024ca595-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-5d004a2b45b6edd62e3ae41e7d1e3b204894ee49-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-5d004a2b45b6edd62e3ae41e7d1e3b204894ee49-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-7a37693ecbac429c67d2dda37cf5aff2dad11d4f-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-7a37693ecbac429c67d2dda37cf5aff2dad11d4f-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-7cba1f6eb7aa3298248eddd931ac27bfacc2101e-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-7cba1f6eb7aa3298248eddd931ac27bfacc2101e-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-7d2acdd7acc9367d2ef6b676828e42eb2116133a-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-7d2acdd7acc9367d2ef6b676828e42eb2116133a-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-7e197938365e9cd839655de7cbcaed820fc9fc67-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-7e197938365e9cd839655de7cbcaed820fc9fc67-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-7f320946f63c9bef713e947e57629af92e16b90a-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-7f320946f63c9bef713e947e57629af92e16b90a-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-873e96329e8f5019d2ddb22878a8b4d6ba0d17b9-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-873e96329e8f5019d2ddb22878a8b4d6ba0d17b9-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-9ab8ab9d7430f52c4ccb1229e7e6f3310919c497-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-9ab8ab9d7430f52c4ccb1229e7e6f3310919c497-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-a0584e072e1489f203ed67c8ce5b73aef3b89f09-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-a0584e072e1489f203ed67c8ce5b73aef3b89f09-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-a45958bf4cf0e7b50872a1155e5310b8b632d72f-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-a45958bf4cf0e7b50872a1155e5310b8b632d72f-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-a5a901d7e1b3106ad257acd2c48c44f2b2ca7c16-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-a5a901d7e1b3106ad257acd2c48c44f2b2ca7c16-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-a910dd1e22ad869a46b225a6f9c78a7afeb2ea7c-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-a910dd1e22ad869a46b225a6f9c78a7afeb2ea7c-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-ae372df44a368be67aa92fe676bcf9a3932fc3da-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-ae372df44a368be67aa92fe676bcf9a3932fc3da-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-bd12fba1309885b318ee6fb25ecb9d751893b7de-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-bd12fba1309885b318ee6fb25ecb9d751893b7de-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-dc689ef86fddb358e8bc0026ccf1c700d3eb5071-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-dc689ef86fddb358e8bc0026ccf1c700d3eb5071-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-e1c73f42c3979b00e3965faa4e3002e42ae921c5-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-e1c73f42c3979b00e3965faa4e3002e42ae921c5-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-ed2b64656b0b4dfc1a3ed6ea15743cac7982dab3-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-ed2b64656b0b4dfc1a3ed6ea15743cac7982dab3-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-f026d89e2125d60153b680416a2a85f2102e30b4-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-f026d89e2125d60153b680416a2a85f2102e30b4-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/error/exception-f16619b350b11d03a2b36dbe9273e9cd164d2ade-ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/error/exception-f16619b350b11d03a2b36dbe9273e9cd164d2ade-ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/tools.py: -------------------------------------------------------------------------------- 1 | from sys import platform 2 | 3 | if platform == 'win32': 4 | from win32process import (GetCurrentProcess, SetPriorityClass, 5 | BELOW_NORMAL_PRIORITY_CLASS) 6 | 7 | def beNice(): 8 | process = GetCurrentProcess() 9 | # FIXME: Not supported on Windows 95/98/Me/NT: ignore error? 10 | # which error? 11 | SetPriorityClass(process, BELOW_NORMAL_PRIORITY_CLASS) 12 | 13 | OS_ERRORS = (OSError, WindowsError) 14 | else: 15 | from os import nice 16 | 17 | def beNice(): 18 | nice(19) 19 | 20 | OS_ERRORS = OSError 21 | 22 | try: 23 | import sha 24 | def generateUniqueID(data): 25 | return sha.new(data).hexdigest() 26 | except ImportError: 27 | def generateUniqueID(data): 28 | generateUniqueID.sequence += 1 29 | return generateUniqueID.sequence 30 | generateUniqueID.sequence = 0 31 | 32 | def getFilesize(file): 33 | file.seek(0, 2) 34 | size = file.tell() 35 | file.seek(0, 0) 36 | return size 37 | 38 | -------------------------------------------------------------------------------- /hachoir/hachoir-tools/fuzzer/zip/ok.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/hachoir/hachoir-tools/fuzzer/zip/ok.zip -------------------------------------------------------------------------------- /hachoir/hachoir-tools/package.sh: -------------------------------------------------------------------------------- 1 | svn info | grep Revision > revision.txt 2 | 7z a '-xr!?svn/' ../DLLHijackAuditKit.zip ./ 3 | rm -f revision.txt 4 | 5 | -------------------------------------------------------------------------------- /hachoir/hachoir-urwid/AUTHORS: -------------------------------------------------------------------------------- 1 | Julien Muchembled 2 | Victor Stinner aka haypo 3 | 4 | -------------------------------------------------------------------------------- /hachoir/hachoir-urwid/hachoir_urwid/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_urwid.urwid_ui import exploreFieldSet 2 | from hachoir_urwid.version import VERSION as __version__ 3 | 4 | -------------------------------------------------------------------------------- /hachoir/hachoir-urwid/hachoir_urwid/version.py: -------------------------------------------------------------------------------- 1 | VERSION = "1.1" 2 | PACKAGE = "hachoir-urwid" 3 | WEBSITE = 'http://bitbucket.org/haypo/hachoir/wiki/hachoir-urwid' 4 | LICENSE = 'GNU GPL v2' 5 | 6 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/AUTHORS: -------------------------------------------------------------------------------- 1 | Authors 2 | ------- 3 | 4 | * Cyril Zorin 5 | * Robert Xiao aka nneonneo 6 | * Julien Muchembled 7 | 8 | Contributors 9 | ------------ 10 | 11 | * Gentaro Muramatsu aka genta_hgr : Virtual ListCtrl 12 | for the field view 13 | * Victor Stinner aka haypo : bugfixes 14 | 15 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/BUGS: -------------------------------------------------------------------------------- 1 | Known bugs 2 | ========== 3 | 4 | * [All]: Field view "Merge Down" doesn't work. 5 | 6 | * [Windows only]: Hex view only shows a ~4x5 char display of the 7 | data. This is believed to be due to a wxWidgets bugs related to text 8 | wrapping. 9 | 10 | * [Windows only]: Right-click context menu doesn't work. 11 | 12 | * [Windows only]: Hex view data marking doesn't work. 13 | 14 | * [Gtk only]: Hex view will occasionally show two scrollbars for the 15 | hex view if you resize the very quickly. This is likely a bug in 16 | wxGtk that (for some reason) ignores the "no vertical scrollbar" 17 | directive for text controls. 18 | 19 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/README: -------------------------------------------------------------------------------- 1 | hachoir-wx is a wxWidgets-based program that's meant to provide a 2 | (more) user-friendly interface to the facilities provided by the 3 | hachoir binary parser core. 4 | 5 | For latest updates, to ask for a feature (please do!), and 6 | bleeding(-edge) source code see the website: 7 | http://bitbucket.org/haypo/hachoir/wiki/hachoir-wx 8 | 9 | Everyone is very welcome to contribute code =) 10 | 11 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir-wx: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | 4 | from hachoir_wx.app import app_t 5 | from hachoir_wx.version import PACKAGE, VERSION, WEBSITE 6 | from hachoir_core.cmd_line import (getHachoirOptions, 7 | configureHachoir, unicodeFilename) 8 | from optparse import OptionParser 9 | import sys 10 | 11 | def parseOptions(): 12 | parser = OptionParser(usage="%prog [options] [filename]") 13 | hachoir = getHachoirOptions(parser) 14 | parser.add_option_group(hachoir) 15 | 16 | values, arguments = parser.parse_args() 17 | if len(arguments) == 1: 18 | filename = arguments[0] 19 | elif not arguments: 20 | filename = None 21 | else: 22 | parser.print_help() 23 | sys.exit(1) 24 | return values, filename 25 | 26 | def main(): 27 | print "%s version %s" % (PACKAGE, VERSION) 28 | print WEBSITE 29 | print 30 | values, filename = parseOptions() 31 | configureHachoir(values) 32 | app = app_t(filename) 33 | app.MainLoop() 34 | 35 | if __name__ == '__main__': 36 | main() 37 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/__init__.py: -------------------------------------------------------------------------------- 1 | from hachoir_wx.version import VERSION as __version__ 2 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/dialogs.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import wx, os 4 | from hachoir_core.i18n import _ 5 | 6 | def file_open_dialog(): 7 | dialog_style = wx.OPEN | wx.FILE_MUST_EXIST 8 | 9 | dialog = wx.FileDialog( 10 | None, message = _('Open'), 11 | defaultDir = os.getcwd(), 12 | defaultFile = '', style = dialog_style) 13 | 14 | return dialog 15 | 16 | def file_save_dialog(title): 17 | dialog_style = wx.SAVE 18 | 19 | dialog = wx.FileDialog( 20 | None, message = title, 21 | defaultDir = os.getcwd(), 22 | defaultFile = '', style = dialog_style) 23 | 24 | return dialog 25 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/dispatcher.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | class dispatcher_t: 4 | def __init__(self): 5 | self.receivers = [] 6 | 7 | def add(self, who): 8 | self.add_sender(who) 9 | self.add_receiver(who) 10 | 11 | def add_sender(self, sender): 12 | sender.dispatcher = self 13 | 14 | def add_receiver(self, receiver): 15 | self.receivers.append(receiver) 16 | 17 | def trigger(self, event_name, *args): 18 | handler_name = 'on_' + event_name 19 | unhandled_name = 'on_unhandled' 20 | 21 | for receiver in self.receivers: 22 | if hasattr(receiver, handler_name): 23 | getattr(receiver, handler_name)(self, *args) 24 | elif hasattr(receiver, unhandled_name): 25 | getattr(receiver, unhandled_name)(self, event_name, *args) 26 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/field_view/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from field_view_setup import setup_field_view 4 | from field_view import field_view_t 5 | 6 | from field_menu_setup import setup_field_menu 7 | from field_menu import field_menu_t 8 | 9 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/field_view/core_type_menu.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import wx 4 | 5 | class core_type_menu_t: 6 | def __init__(self, menu): 7 | self.menu = menu 8 | self.id_to_type = {} 9 | 10 | self.Bind = self.menu.Bind # see note in field_menu.py 11 | 12 | def add_type(self, type_name): 13 | type_id = wx.NewId() 14 | self.id_to_type[type_id] = type_name 15 | self.menu.Append(type_id, type_name) 16 | 17 | def get_type_name(self, id): 18 | return self.id_to_type[id] 19 | 20 | def clear(self): 21 | items = self.menu.GetMenuItems() 22 | for item in items: 23 | self.menu.DeleteItem(item) # TODO: what's the difference between Remove and Delete? 24 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/field_view/core_type_menu_fwd.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import wx 4 | 5 | class core_type_menu_fwd_t: 6 | def __init__(self, imp): 7 | self.imp = imp 8 | 9 | def on_field_menu_ready(self, dispatcher, view): 10 | assert view is not None 11 | view.Bind(wx.EVT_MENU, self.on_type_selected) 12 | 13 | def on_type_selected(self, event): 14 | try: 15 | self.imp.on_type_selected(event.GetId()) 16 | except KeyError: 17 | event.Skip() 18 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/field_view/core_type_menu_imp.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from hachoir_core.field import available_types 4 | from hachoir_wx.field_view.mutator import convert_field 5 | from hachoir_wx.field_view.stubs import can_convert 6 | 7 | class core_type_menu_imp_t: 8 | def __init__(self): 9 | self.cur_field = None 10 | 11 | def on_core_type_menu_ready(self, dispatcher, view): 12 | assert view is not None 13 | self.view = view 14 | 15 | def on_type_selected(self, id): 16 | convert_field(self.cur_field, self.view.get_type_name(id)) 17 | self.dispatcher.trigger('field_modified', self.cur_field) 18 | 19 | def on_field_selected(self, dispatcher, field): 20 | self.cur_field = field 21 | 22 | self.view.clear() 23 | for type in available_types: 24 | if can_convert(field, type) and field.__class__ is not type: 25 | self.view.add_type(type.__name__) 26 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/field_view/field_menu.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from hachoir_wx.dialogs import file_save_dialog 4 | import wx 5 | 6 | class field_menu_t: 7 | def __init__(self, parent, menu): 8 | self.parent = parent 9 | self.menu = menu 10 | 11 | # forward this call because xrc doesn't allow menu 12 | # subclassing (as of 2.6.3) 13 | self.Bind = self.menu.Bind 14 | 15 | def show_opts(self): 16 | self.parent.PopupMenu(self.menu) 17 | 18 | def ask_for_dump_file(self, title): 19 | dump_dlog = file_save_dialog(title) 20 | if wx.ID_OK == dump_dlog.ShowModal(): 21 | return dump_dlog.GetPath() 22 | 23 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/field_view/field_menu_fwd.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from wx import EVT_MENU 4 | from wx.xrc import XRCID 5 | 6 | class field_menu_fwd_t: 7 | def __init__(self, imp): 8 | self.imp = imp 9 | 10 | def on_field_view_ready(self, dispatcher, view): 11 | assert view is not None 12 | 13 | view.Bind(EVT_MENU, self.imp.on_addr_rel, 14 | id=XRCID('field_menu_address_relative')) 15 | view.Bind(EVT_MENU, self.imp.on_addr_abs, 16 | id=XRCID('field_menu_address_absolute')) 17 | view.Bind(EVT_MENU, self.imp.on_addr_hex, 18 | id=XRCID('field_menu_address_base_hex')) 19 | view.Bind(EVT_MENU, self.imp.on_addr_dec, 20 | id=XRCID('field_menu_address_base_dec')) 21 | view.Bind(EVT_MENU, self.imp.on_dump_to_disk, 22 | id=XRCID('field_menu_dump_to_disk')) 23 | view.Bind(EVT_MENU, self.imp.on_parse_substream, 24 | id=XRCID('field_menu_parse_substream')) 25 | view.Bind(EVT_MENU, self.imp.on_open_window_here, 26 | id=XRCID('field_menu_open_window_here')) 27 | 28 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/field_view/field_split_menu.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from wx import GetNumberFromUser 4 | from hachoir_core.i18n import _ 5 | 6 | class field_split_menu_t: 7 | def __init__(self, parent, menu): 8 | self.parent = parent 9 | self.menu = menu 10 | self.Bind = self.menu.Bind # see note in field_menu.py 11 | 12 | def ask_split(self, caption, min, max): 13 | num = GetNumberFromUser(_('Enter split offset:'), '', 14 | caption, min, min, max, self.parent) 15 | 16 | if -1 == num: 17 | return None 18 | else: 19 | return num 20 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/field_view/field_split_menu_fwd.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import wx 4 | 5 | class field_split_menu_fwd_t: 6 | def __init__(self, imp): 7 | self.imp = imp 8 | 9 | def on_field_menu_ready(self, dispatcher, view): 10 | assert view is not None 11 | 12 | view.Bind(wx.EVT_MENU, self.on_split_bytes, 13 | id = wx.xrc.XRCID('field_menu_split_bytes')) 14 | view.Bind(wx.EVT_MENU, self.on_split_bits, 15 | id = wx.xrc.XRCID('field_menu_split_bits')) 16 | 17 | def on_split_bits(self, event): 18 | self.imp.on_split_bits() 19 | 20 | def on_split_bytes(self, event): 21 | self.imp.on_split_bytes() 22 | 23 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/field_view/field_view_fwd.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import wx 4 | 5 | class field_view_fwd_t: 6 | def __init__(self, imp): 7 | self.imp = imp 8 | 9 | def on_field_view_ready(self, dispatcher, field_view): 10 | assert field_view is not None 11 | 12 | field_view.Bind(wx.EVT_COMMAND_RIGHT_CLICK, self.on_item_right_clicked) 13 | field_view.Bind(wx.EVT_RIGHT_UP, self.on_item_right_clicked) 14 | field_view.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.on_item_activated) 15 | field_view.Bind(wx.EVT_LIST_ITEM_SELECTED, self.on_item_selected) 16 | 17 | def on_item_activated(self, event): 18 | self.imp.on_item_activated() 19 | 20 | def on_item_selected(self, event): 21 | self.imp.on_item_selected() 22 | 23 | def on_item_right_clicked(self, event): 24 | self.imp.on_item_show_ops() 25 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/field_view/field_view_setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from hachoir_wx.resource import get_child_control 4 | from field_view_imp import field_view_imp_t 5 | from field_view_fwd import field_view_fwd_t 6 | from field_menu_setup import setup_field_menu 7 | 8 | def setup_field_view(parent, dispatcher): 9 | print "[+] Setup field view" 10 | field_view = get_child_control(parent, 'field_view') 11 | dispatcher.add_sender(field_view) 12 | 13 | field_view_imp = field_view_imp_t() 14 | dispatcher.add(field_view_imp) 15 | 16 | field_view_fwd = field_view_fwd_t(field_view_imp) 17 | dispatcher.add(field_view_fwd) 18 | 19 | setup_field_menu(field_view, dispatcher) 20 | 21 | return field_view 22 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/field_view/format.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | def format_addr_dec(addr): 4 | return "%08d.%01d" % divmod(addr, 8) 5 | 6 | def format_addr_hex(addr): 7 | return "%08x.%01d" % divmod(addr, 8) 8 | 9 | def format_size(size): 10 | return "%08u.%01d" % divmod(size, 8) 11 | 12 | def format_data(field): 13 | data = '' 14 | 15 | if field.hasValue(): 16 | data = field.display 17 | 18 | return data 19 | 20 | def format_name(field): 21 | name = field._getName() 22 | if field.is_field_set: 23 | name += '/' 24 | 25 | return name 26 | 27 | def format_desc(field): 28 | if field.description: 29 | return unicode(field.description) 30 | return u'' 31 | 32 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/field_view/mutator.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from hachoir_core import field as field_module 4 | from hachoir_wx.field_view.stubs import has_static_size, convert_size 5 | 6 | def split_field(field, split_pos, split_name, split_t, size_func): 7 | split_name += '[]' 8 | 9 | subfields = [ 10 | split_t(field._parent, split_name, split_pos), 11 | split_t(field._parent, split_name, size_func(field) - split_pos) 12 | ] 13 | 14 | field._parent.replaceField(field._getName(), subfields) 15 | 16 | def convert_field(field, new_type_name): 17 | field_set = field._parent 18 | new_type = getattr(field_module, new_type_name) 19 | 20 | if has_static_size(new_type): 21 | new_field = new_type(field_set, field._getName(), field._getDescription()) 22 | else: 23 | new_field = new_type(field_set, field._getName(), convert_size(field, new_type), field._getDescription()) 24 | 25 | field_set.replaceField(field._getName(), [new_field]) 26 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/frame_view/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from frame_view import frame_view_t 4 | from frame_view_setup import setup_frame_view 5 | from frame_view_imp import frame_view_imp_t 6 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/frame_view/frame_view.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from wx import Frame, PreFrame 4 | 5 | class frame_view_t(Frame): 6 | def __init__(self): 7 | pre = PreFrame() 8 | self.PostCreate(pre) 9 | 10 | def ready(self): 11 | self.dispatcher.trigger('frame_view_ready', self) 12 | 13 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/frame_view/frame_view_fwd.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import wx 4 | 5 | class frame_view_fwd_t: 6 | def __init__(self, imp): 7 | self.imp = imp 8 | 9 | def on_frame_view_ready(self, dispatcher, view): 10 | assert view is not None 11 | view.Bind(wx.EVT_ACTIVATE, self.on_activated) 12 | view.Bind(wx.EVT_SHOW, self.on_shown) 13 | 14 | def on_activated(self, event): 15 | if event.GetActive(): 16 | self.imp.on_activated() 17 | 18 | def on_shown(self, event): 19 | if event.GetShow(): 20 | self.imp.on_activated() 21 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/frame_view/frame_view_imp.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | class frame_view_imp_t: 4 | def on_frame_view_ready(self, dispatcher, frame_view): 5 | assert frame_view is not None 6 | self.view = frame_view 7 | 8 | def on_file_ready(self, dispatcher, file): 9 | assert file is not None 10 | self.filename = file.name 11 | 12 | def on_filename_update(self, dispatcher, filename): 13 | self.filename = filename 14 | 15 | def format_title(self, field): 16 | field_path = field._getPath() 17 | return self.filename+'/'+field_path[1:] 18 | 19 | def on_field_activated(self, dispatcher, field): 20 | self.view.SetTitle(self.format_title(field)) 21 | 22 | def on_activated(self): 23 | self.dispatcher.trigger('frame_activated', self.view) 24 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/frame_view/frame_view_setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from frame_view_imp import frame_view_imp_t 4 | from frame_view_fwd import frame_view_fwd_t 5 | 6 | from hachoir_wx.resource import get_frame 7 | 8 | def setup_frame_view(dispatcher): 9 | print '[+] Setup frame view' 10 | frame = get_frame('frame_view') 11 | dispatcher.add_sender(frame) 12 | 13 | frame_view_imp = frame_view_imp_t() 14 | dispatcher.add(frame_view_imp) 15 | 16 | frame_view_fwd = frame_view_fwd_t(frame_view_imp) 17 | dispatcher.add_receiver(frame_view_fwd) 18 | 19 | return frame 20 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/hex_view/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # platform workarounds 4 | import wx 5 | if '__WXGTK__' == wx.Platform: 6 | from compat_gtk import get_width_chars, get_height_chars 7 | elif '__WXMSW__' == wx.Platform: 8 | from compat_msw import get_width_chars, get_height_chars 9 | else: 10 | from compat_all import get_width_chars, get_height_chars 11 | 12 | from hex_view import hex_view_t 13 | from hex_view_scroll import hex_view_scroll_t 14 | from hex_view_setup import setup_hex_view 15 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/hex_view/compat_all.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | MAX_LINE_TEST = 10 * 1024 4 | 5 | def get_width_chars(view): 6 | if not view.GetLineLength(0): 7 | padding = ' ' * MAX_LINE_TEST 8 | view.SetValue(padding) 9 | 10 | return view.GetLineLength(0) // 3 11 | 12 | def get_height_chars(view): 13 | return view.GetClientSize()[1] // view.GetCharHeight() 14 | 15 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/hex_view/compat_gtk.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # compatibility routines to work around bugs in wxgtk 4 | def get_width_chars(view): 5 | return (view.GetClientSize()[0] - 4) // view.GetCharWidth() // 3 6 | 7 | def get_height_chars(view): 8 | return (view.GetClientSize()[1] - 4) // view.GetCharHeight() 9 | 10 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/hex_view/compat_msw.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Windows wx compatibility 4 | 5 | def get_width_chars(view): 6 | return ((view.GetClientSize()[0]-3) // (view.GetCharWidth()-1) - 1) // 3 7 | 8 | def get_height_chars(view): 9 | return view.GetClientSize()[1] // view.GetCharHeight() 10 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/hex_view/hex_view_fwd.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from wx import EVT_SIZE 4 | 5 | class hex_view_fwd_t: 6 | def __init__(self, imp): 7 | self.imp = imp 8 | 9 | def on_hex_view_ready(self, dispatcher, view): 10 | assert view is not None 11 | 12 | view.Bind(EVT_SIZE, self.on_resized) 13 | 14 | def on_resized(self, event): 15 | self.imp.on_resized() 16 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/hex_view/hex_view_scroll.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from wx import ScrollBar, PreScrollBar 4 | 5 | class hex_view_scroll_t(ScrollBar): 6 | def __init__(self): 7 | pre = PreScrollBar() 8 | self.PostCreate(pre) 9 | 10 | def ready(self): 11 | self.dispatcher.trigger('hex_view_scroll_ready', self) 12 | 13 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/hex_view/hex_view_scroll_fwd.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import wx 4 | 5 | class hex_view_scroll_fwd_t: 6 | def __init__(self, imp): 7 | self.imp = imp 8 | 9 | def on_hex_view_scroll_ready(self, dispatcher, view): 10 | assert view is not None 11 | view.Bind(wx.EVT_SCROLL, self.on_scrolled) 12 | 13 | def on_scrolled(self, event): 14 | self.imp.on_scrolled() 15 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/hex_view/hex_view_scroll_setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from hachoir_wx.resource import get_child_control 4 | from hex_view_scroll_fwd import hex_view_scroll_fwd_t 5 | from hex_view_scroll_imp import hex_view_scroll_imp_t 6 | 7 | def setup_hex_view_scroll(parent, dispatcher): 8 | scroll = get_child_control(parent, 'hex_view_scroll') 9 | dispatcher.add_sender(scroll) 10 | 11 | imp = hex_view_scroll_imp_t() 12 | dispatcher.add(imp) 13 | 14 | fwd = hex_view_scroll_fwd_t(imp) 15 | dispatcher.add_receiver(fwd) 16 | 17 | scroll.ready() 18 | 19 | return scroll 20 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/hex_view/hex_view_setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from hachoir_wx.resource import get_child_control 4 | from hex_view_imp import hex_view_imp_t 5 | from hex_view_fwd import hex_view_fwd_t 6 | from hex_view_scroll_setup import setup_hex_view_scroll 7 | 8 | def setup_hex_view(parent, dispatcher): 9 | print "[+] Setup hex view" 10 | hex_view = get_child_control(parent, 'hex_view') 11 | hex_view.ascii_view = get_child_control(parent, 'ascii_view') 12 | hex_view.addr_view = get_child_control(parent, 'addr_view') 13 | dispatcher.add_sender(hex_view) 14 | 15 | imp = hex_view_imp_t() 16 | dispatcher.add(imp) 17 | 18 | fwd = hex_view_fwd_t(imp) 19 | dispatcher.add_receiver(fwd) 20 | 21 | setup_hex_view_scroll(parent, dispatcher) 22 | 23 | return hex_view 24 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/resource/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from hachoir_wx.resource.resource import * 4 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/resource/resource.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import os 4 | from wx.xrc import XmlResource, XRCCTRL 5 | 6 | def get_resource(): 7 | filename = os.path.join(os.getcwd(), os.path.dirname(__file__), 'hachoir_wx.xrc') 8 | return XmlResource(filename) 9 | 10 | def get_frame(name): 11 | return get_resource().LoadFrame(None, name) 12 | 13 | def get_child_control(parent, child): 14 | return XRCCTRL(parent, child) 15 | 16 | def get_menu_bar(name): 17 | return get_resource().LoadMenuBar(name) 18 | 19 | def get_menu_from_bar(menu_bar, menu_name): 20 | menu_index = menu_bar.FindMenu(menu_name) 21 | assert -1 != menu_index, 'cannot find menu ' + menu_name + ' in menu bar ' + menu_bar.GetTitle() 22 | return menu_bar.GetMenu(menu_index) 23 | 24 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/unicode.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import wx 4 | import locale 5 | import sys 6 | 7 | def get_charset(): 8 | try: 9 | charset = locale.getdefaultlocale()[1] 10 | except (locale.Error, NameError, AttributeError, IndexError): 11 | pass 12 | 13 | if charset is None: 14 | charset = sys.getdefaultencoding() 15 | 16 | return charset 17 | 18 | def force_unicode(name): 19 | if not isinstance(name, unicode): 20 | charset = get_charset() 21 | name = unicode(name, charset) 22 | 23 | return name 24 | -------------------------------------------------------------------------------- /hachoir/hachoir-wx/hachoir_wx/version.py: -------------------------------------------------------------------------------- 1 | PACKAGE = "hachoir-wx" 2 | VERSION = "0.3.1" 3 | WEBSITE = 'http://bitbucket.org/haypo/hachoir/wiki/hachoir-wx' 4 | LICENSE = 'GNU GPL v2' 5 | 6 | -------------------------------------------------------------------------------- /hachoir/test_code.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | [ "$PYTHON" ] || PYTHON=python 6 | [ "$TESTCASE" ] || TESTCASE=~/testcase/ 7 | 8 | ROOT=$(cd $(dirname $0); pwd) 9 | 10 | source $ROOT/setupenv.sh 11 | 12 | echo "=== hachoir-core: test doc ===" 13 | cd $ROOT/hachoir-core 14 | $PYTHON test_doc.py 15 | 16 | echo "=== download and check testcase ===" 17 | $PYTHON $ROOT/hachoir-parser/tests/download_testcase.py $TESTCASE 18 | 19 | echo "=== hachoir-parser: testcase ===" 20 | $PYTHON $ROOT/hachoir-parser/tests/run_testcase.py $TESTCASE 21 | 22 | echo "=== hachoir-metadata: testcase ===" 23 | $PYTHON $ROOT/hachoir-metadata/test_doc.py 24 | 25 | echo "=== hachoir-metadata: testcase ===" 26 | $PYTHON $ROOT/hachoir-metadata/run_testcase.py $TESTCASE 27 | 28 | echo "=== hachoir-regex: tests ===" 29 | $PYTHON $ROOT/hachoir-regex/test_doc.py 30 | -------------------------------------------------------------------------------- /hachoir/test_code_snapshot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Script to test all Hachoir programs 4 | # You can specify your testcase directory or your Python version with: 5 | # 6 | # PYTHON=python2.5 TESTCASE=~/testcase ./testall.sh 7 | 8 | ROOT=$(cd $(dirname $0); pwd) 9 | export PYTHONPATH=$PYTHONPATH:$ROOT 10 | if [ "x$PYTHON" == "x" ]; then 11 | PYTHON=python 12 | fi 13 | if [ "x$TESTCASE" == "x" ]; then 14 | TESTCASE=$ROOT/testcase 15 | fi 16 | 17 | echo "=== download and check testcase ===" 18 | $PYTHON $ROOT/download_testcase.py $TESTCASE || exit $? 19 | 20 | echo "=== hachoir-parser: testcase ===" 21 | $PYTHON $ROOT/test_parser.py $TESTCASE || exit $? 22 | 23 | echo "=== hachoir-metadata: testcase ===" 24 | $PYTHON $ROOT/test_metadata.py $TESTCASE || exit $? 25 | 26 | -------------------------------------------------------------------------------- /htmler/parsedtd.py: -------------------------------------------------------------------------------- 1 | from xml.parsers.xmlproc import dtdparser, xmlapp 2 | import sys 3 | 4 | class DTDConsume(xmlapp.DTDConsumer): 5 | 6 | def __init__(self, elems, attrs): 7 | self.attrs = attrs 8 | self.elems = elems 9 | 10 | def new_attribute(self, elem, attr, a_type, a_decl, a_def): 11 | self.elems.append(elem) 12 | self.attrs.append(attr) 13 | 14 | def parsedtd(infile): 15 | elems = [] 16 | attrs = [] 17 | p = dtdparser.DTDParser() 18 | p.set_dtd_consumer(DTDConsume(elems, attrs)) 19 | p.parse_resource(infile) 20 | return (elems, attrs) 21 | 22 | (e, a) = parsedtd(sys.argv[1]) 23 | for ee in set(e): 24 | print """'%s',""" % ee 25 | 26 | print 27 | print 28 | 29 | for aa in set(a): 30 | print """'%s',""" % aa 31 | -------------------------------------------------------------------------------- /jsfunfuzz/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/jsfunfuzz/.DS_Store -------------------------------------------------------------------------------- /jsfunfuzz/jsfunfuzz.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /kernfuzz/Makefile: -------------------------------------------------------------------------------- 1 | KMOD= kernfuzz 2 | SRCS= freebsd.c 3 | 4 | .include 5 | -------------------------------------------------------------------------------- /kernfuzz/kfuzz.c: -------------------------------------------------------------------------------- 1 | /** 2 | * kfuzz.c - some functions for in kernel fuzzing. 3 | * 4 | * (c) 2010 -- Clément LECIGNE 5 | */ 6 | 7 | /** 8 | * fuzzing kernel memory 9 | */ 10 | void kfuzz(char *mem, size_t len) 11 | { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /kernusse/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | gcc -O3 -o netusse netusse.c -D__LINUX__ -g 3 | -------------------------------------------------------------------------------- /kernusse/netusse.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/kernusse/netusse.c -------------------------------------------------------------------------------- /pycapreplay/dpkt/.svn/entries: -------------------------------------------------------------------------------- 1 | 12 2 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/.svn/format: -------------------------------------------------------------------------------- 1 | 12 2 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/.svn/wc.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/pycapreplay/dpkt/.svn/wc.db -------------------------------------------------------------------------------- /pycapreplay/dpkt/HACKING: -------------------------------------------------------------------------------- 1 | 2 | zero'd checksum fields should be computed and set in __str__() 3 | 4 | length fields should not be set except manually (maybe automatically 5 | in set_data() methods?) 6 | 7 | set_data() should do nice length field, zero'd checksum, named member, 8 | etc. fixups like the unpacking constructor... maybe later 9 | 10 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/Makefile: -------------------------------------------------------------------------------- 1 | # $Id: Makefile 345 2006-02-01 15:47:16Z dugsong $ 2 | 3 | PYTHON = python2 4 | #BDIST_MPKG= bdist_mpkg 5 | BDIST_MPKG= /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/bin/bdist_mpkg 6 | PKGDIR = dpkt-`egrep version dpkt/__init__.py | cut -f2 -d"'"` 7 | URL = `egrep url dpkt/__init__.py | cut -f2 -d"'"` 8 | 9 | all: 10 | $(PYTHON) setup.py build 11 | 12 | install: 13 | $(PYTHON) setup.py install 14 | 15 | test: 16 | $(PYTHON) test.py 17 | 18 | doc: 19 | epydoc -o doc -n dpkt -u $(URL) --docformat=plaintext ./dpkt/ 20 | 21 | pkg_win32: 22 | $(PYTHON) setup.py bdist_wininst 23 | 24 | pkg_osx: 25 | $(BDIST_MPKG) --readme=README --license=LICENSE 26 | PKGNAME=`basename dist/*.mpkg | sed s/\.mpkg//` ; \ 27 | hdiutil create -srcfolder dist -volname $${PKGNAME} $${PKGNAME}.dmg 28 | 29 | clean: 30 | rm -rf build dist doc *.dmg 31 | 32 | cleandir distclean: clean 33 | rm -f *.pyc *~ */*.pyc */*~ 34 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/README: -------------------------------------------------------------------------------- 1 | 2 | dpkt 3 | ---- 4 | 5 | Fast, simple packet creation and parsing. 6 | 7 | We have no docs, but only sample code (see examples/) for now. 8 | 9 | --- 10 | http://dpkt.googlecode.com/ 11 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/ah.py: -------------------------------------------------------------------------------- 1 | # $Id: ah.py 34 2007-01-28 07:54:20Z dugsong $ 2 | 3 | """Authentication Header.""" 4 | 5 | import dpkt 6 | 7 | class AH(dpkt.Packet): 8 | __hdr__ = ( 9 | ('nxt', 'B', 0), 10 | ('len', 'B', 0), # payload length 11 | ('rsvd', 'H', 0), 12 | ('spi', 'I', 0), 13 | ('seq', 'I', 0) 14 | ) 15 | auth = '' 16 | def unpack(self, buf): 17 | dpkt.Packet.unpack(self, buf) 18 | self.auth = self.data[:self.len] 19 | buf = self.data[self.len:] 20 | import ip 21 | try: 22 | self.data = ip.IP.get_proto(self.nxt)(buf) 23 | setattr(self, self.data.__class__.__name__.lower(), self.data) 24 | except (KeyError, dpkt.UnpackError): 25 | self.data = buf 26 | 27 | def __len__(self): 28 | return self.__hdr_len__ + len(self.auth) + len(self.data) 29 | 30 | def __str__(self): 31 | return self.pack_hdr() + str(self.auth) + str(self.data) 32 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/arp.py: -------------------------------------------------------------------------------- 1 | # $Id: arp.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Address Resolution Protocol.""" 4 | 5 | import dpkt 6 | 7 | # Hardware address format 8 | ARP_HRD_ETH = 0x0001 # ethernet hardware 9 | ARP_HRD_IEEE802 = 0x0006 # IEEE 802 hardware 10 | 11 | # Protocol address format 12 | ARP_PRO_IP = 0x0800 # IP protocol 13 | 14 | # ARP operation 15 | ARP_OP_REQUEST = 1 # request to resolve ha given pa 16 | ARP_OP_REPLY = 2 # response giving hardware address 17 | ARP_OP_REVREQUEST = 3 # request to resolve pa given ha 18 | ARP_OP_REVREPLY = 4 # response giving protocol address 19 | 20 | class ARP(dpkt.Packet): 21 | __hdr__ = ( 22 | ('hrd', 'H', ARP_HRD_ETH), 23 | ('pro', 'H', ARP_PRO_IP), 24 | ('hln', 'B', 6), # hardware address length 25 | ('pln', 'B', 4), # protocol address length 26 | ('op', 'H', ARP_OP_REQUEST), 27 | ('sha', '6s', ''), 28 | ('spa', '4s', ''), 29 | ('tha', '6s', ''), 30 | ('tpa', '4s', '') 31 | ) 32 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/dtp.py: -------------------------------------------------------------------------------- 1 | # $Id: dtp.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Dynamic Trunking Protocol.""" 4 | 5 | import struct 6 | import dpkt 7 | 8 | class DTP(dpkt.Packet): 9 | __hdr__ = ( 10 | ('v', 'B', 0), 11 | ) # rest is TLVs 12 | def unpack(self, buf): 13 | dpkt.Packet.unpack(self, buf) 14 | buf = self.data 15 | tvs = [] 16 | while buf: 17 | t, l = struct.unpack('>HH', buf[:4]) 18 | v, buf = buf[4:4+l], buf[4+l:] 19 | tvs.append((t, v)) 20 | self.data = tvs 21 | 22 | TRUNK_NAME = 0x01 23 | MAC_ADDR = 0x04 24 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/esp.py: -------------------------------------------------------------------------------- 1 | # $Id: esp.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Encapsulated Security Protocol.""" 4 | 5 | import dpkt 6 | 7 | class ESP(dpkt.Packet): 8 | __hdr__ = ( 9 | ('spi', 'I', 0), 10 | ('seq', 'I', 0) 11 | ) 12 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/hsrp.py: -------------------------------------------------------------------------------- 1 | # $Id: hsrp.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Cisco Hot Standby Router Protocol.""" 4 | 5 | import dpkt 6 | 7 | # Opcodes 8 | HELLO = 0 9 | COUP = 1 10 | RESIGN = 2 11 | 12 | # States 13 | INITIAL = 0x00 14 | LEARN = 0x01 15 | LISTEN = 0x02 16 | SPEAK = 0x04 17 | STANDBY = 0x08 18 | ACTIVE = 0x10 19 | 20 | class HSRP(dpkt.Packet): 21 | __hdr__ = ( 22 | ('version', 'B', 0), 23 | ('opcode', 'B', 0), 24 | ('state', 'B', 0), 25 | ('hello', 'B', 0), 26 | ('hold', 'B', 0), 27 | ('priority', 'B', 0), 28 | ('group', 'B', 0), 29 | ('rsvd', 'B', 0), 30 | ('auth', '8s', 'cisco'), 31 | ('vip', '4s', '') 32 | ) 33 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/igmp.py: -------------------------------------------------------------------------------- 1 | # $Id: igmp.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Internet Group Management Protocol.""" 4 | 5 | import dpkt 6 | 7 | class IGMP(dpkt.Packet): 8 | __hdr__ = ( 9 | ('type', 'B', 0), 10 | ('maxresp', 'B', 0), 11 | ('sum', 'H', 0), 12 | ('group', 'I', 0) 13 | ) 14 | def __str__(self): 15 | if not self.sum: 16 | self.sum = dpkt.in_cksum(dpkt.Packet.__str__(self)) 17 | return dpkt.Packet.__str__(self) 18 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/ipx.py: -------------------------------------------------------------------------------- 1 | # $Id: ipx.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Internetwork Packet Exchange.""" 4 | 5 | import dpkt 6 | 7 | IPX_HDR_LEN = 30 8 | 9 | class IPX(dpkt.Packet): 10 | __hdr__ = ( 11 | ('sum', 'H', 0xffff), 12 | ('len', 'H', IPX_HDR_LEN), 13 | ('tc', 'B', 0), 14 | ('pt', 'B', 0), 15 | ('dst', '12s', ''), 16 | ('src', '12s', '') 17 | ) 18 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/loopback.py: -------------------------------------------------------------------------------- 1 | # $Id: loopback.py 38 2007-03-17 03:33:16Z dugsong $ 2 | 3 | """Platform-dependent loopback header.""" 4 | 5 | import dpkt, ethernet, ip, ip6 6 | 7 | class Loopback(dpkt.Packet): 8 | __hdr__ = (('family', 'I', 0), ) 9 | __byte_order__ = '@' 10 | def unpack(self, buf): 11 | dpkt.Packet.unpack(self, buf) 12 | if self.family == 2: 13 | self.data = ip.IP(self.data) 14 | elif self.family == 0x02000000: 15 | self.family = 2 16 | self.data = ip.IP(self.data) 17 | elif self.family in (24, 28, 30): 18 | self.data = ip6.IP6(self.data) 19 | elif self.family > 1500: 20 | self.data = ethernet.Ethernet(self.data) 21 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/ospf.py: -------------------------------------------------------------------------------- 1 | # $Id: ospf.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Open Shortest Path First.""" 4 | 5 | import dpkt 6 | 7 | AUTH_NONE = 0 8 | AUTH_PASSWORD = 1 9 | AUTH_CRYPTO = 2 10 | 11 | class OSPF(dpkt.Packet): 12 | __hdr__ = ( 13 | ('v', 'B', 0), 14 | ('type', 'B', 0), 15 | ('len', 'H', 0), 16 | ('router', 'I', 0), 17 | ('area', 'I', 0), 18 | ('sum', 'H', 0), 19 | ('atype', 'H', 0), 20 | ('auth', '8s', '') 21 | ) 22 | def __str__(self): 23 | if not self.sum: 24 | self.sum = dpkt.in_cksum(dpkt.Packet.__str__(self)) 25 | return dpkt.Packet.__str__(self) 26 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/pim.py: -------------------------------------------------------------------------------- 1 | # $Id: pim.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Protocol Independent Multicast.""" 4 | 5 | import dpkt 6 | 7 | class PIM(dpkt.Packet): 8 | __hdr__ = ( 9 | ('v_type', 'B', 0x20), 10 | ('rsvd', 'B', 0), 11 | ('sum', 'H', 0) 12 | ) 13 | def _get_v(self): return self.v_type >> 4 14 | def _set_v(self, v): self.v_type = (v << 4) | (self.v_type & 0xf) 15 | v = property(_get_v, _set_v) 16 | 17 | def _get_type(self): return self.v_type & 0xf 18 | def _set_type(self, type): self.v_type = (self.v_type & 0xf0) | type 19 | type = property(_get_type, _set_type) 20 | 21 | def __str__(self): 22 | if not self.sum: 23 | self.sum = dpkt.in_cksum(dpkt.Packet.__str__(self)) 24 | return dpkt.Packet.__str__(self) 25 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/pmap.py: -------------------------------------------------------------------------------- 1 | # $Id: pmap.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Portmap / rpcbind.""" 4 | 5 | import dpkt 6 | 7 | PMAP_PROG = 100000L 8 | PMAP_PROCDUMP = 4 9 | PMAP_VERS = 2 10 | 11 | class Pmap(dpkt.Packet): 12 | __hdr__ = ( 13 | ('prog', 'I', 0), 14 | ('vers', 'I', 0), 15 | ('prot', 'I', 0), 16 | ('port', 'I', 0), 17 | ) 18 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/pppoe.py: -------------------------------------------------------------------------------- 1 | # $Id: pppoe.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """PPP-over-Ethernet.""" 4 | 5 | import dpkt, ppp 6 | 7 | # RFC 2516 codes 8 | PPPoE_PADI = 0x09 9 | PPPoE_PADO = 0x07 10 | PPPoE_PADR = 0x19 11 | PPPoE_PADS = 0x65 12 | PPPoE_PADT = 0xA7 13 | PPPoE_SESSION = 0x00 14 | 15 | class PPPoE(dpkt.Packet): 16 | __hdr__ = ( 17 | ('v_type', 'B', 0x11), 18 | ('code', 'B', 0), 19 | ('session', 'H', 0), 20 | ('len', 'H', 0) # payload length 21 | ) 22 | def _get_v(self): return self.v_type >> 4 23 | def _set_v(self, v): self.v_type = (v << 4) | (self.v_type & 0xf) 24 | v = property(_get_v, _set_v) 25 | 26 | def _get_type(self): return self.v_type & 0xf 27 | def _set_type(self, t): self.v_type = (self.v_type & 0xf0) | t 28 | type = property(_get_type, _set_type) 29 | 30 | def unpack(self, buf): 31 | dpkt.Packet.unpack(self, buf) 32 | try: 33 | if self.code == 0: 34 | self.data = self.ppp = ppp.PPP(self.data) 35 | except dpkt.UnpackError: 36 | pass 37 | 38 | # XXX - TODO TLVs, etc. 39 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/sip.py: -------------------------------------------------------------------------------- 1 | # $Id: sip.py 48 2008-05-27 17:31:15Z yardley $ 2 | 3 | """Session Initiation Protocol.""" 4 | 5 | import http 6 | 7 | class Request(http.Request): 8 | """SIP request.""" 9 | __hdr_defaults__ = { 10 | 'method':'INVITE', 11 | 'uri':'sip:user@example.com', 12 | 'version':'2.0', 13 | 'headers':{ 'To':'', 'From':'', 'Call-ID':'', 'CSeq':'', 'Contact':'' } 14 | } 15 | __methods = dict.fromkeys(( 16 | 'ACK', 'BYE', 'CANCEL', 'INFO', 'INVITE', 'MESSAGE', 'NOTIFY', 17 | 'OPTIONS', 'PRACK', 'PUBLISH', 'REFER', 'REGISTER', 'SUBSCRIBE', 18 | 'UPDATE' 19 | )) 20 | __proto = 'SIP' 21 | 22 | class Response(http.Response): 23 | """SIP response.""" 24 | __hdr_defaults__ = { 25 | 'version':'2.0', 26 | 'status':'200', 27 | 'reason':'OK', 28 | 'headers':{ 'To':'', 'From':'', 'Call-ID':'', 'CSeq':'', 'Contact':'' } 29 | } 30 | __proto = 'SIP' 31 | 32 | 33 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/sll.py: -------------------------------------------------------------------------------- 1 | # $Id: sll.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Linux libpcap "cooked" capture encapsulation.""" 4 | 5 | import arp, dpkt, ethernet 6 | 7 | class SLL(dpkt.Packet): 8 | __hdr__ = ( 9 | ('type', 'H', 0), # 0: to us, 1: bcast, 2: mcast, 3: other, 4: from us 10 | ('hrd', 'H', arp.ARP_HRD_ETH), 11 | ('hlen', 'H', 6), # hardware address length 12 | ('hdr', '8s', ''), # first 8 bytes of link-layer header 13 | ('ethtype', 'H', ethernet.ETH_TYPE_IP), 14 | ) 15 | _typesw = ethernet.Ethernet._typesw 16 | 17 | def unpack(self, buf): 18 | dpkt.Packet.unpack(self, buf) 19 | try: 20 | self.data = self._typesw[self.ethtype](self.data) 21 | setattr(self, self.data.__class__.__name__.lower(), self.data) 22 | except (KeyError, dpkt.UnpackError): 23 | pass 24 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/smb.py: -------------------------------------------------------------------------------- 1 | # $Id: smb.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Server Message Block.""" 4 | 5 | import dpkt 6 | 7 | class SMB(dpkt.Packet): 8 | __hdr__ = [ 9 | ('proto', '4s', ''), 10 | ('cmd', 'B', 0), 11 | ('err', 'I', 0), 12 | ('flags1', 'B', 0), 13 | ('flags2', 'B', 0), 14 | ('pad', '6s', ''), 15 | ('tid', 'H', 0), 16 | ('pid', 'H', 0), 17 | ('uid', 'H', 0), 18 | ('mid', 'H', 0) 19 | ] 20 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/stp.py: -------------------------------------------------------------------------------- 1 | # $Id: stp.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Spanning Tree Protocol.""" 4 | 5 | import dpkt 6 | 7 | class STP(dpkt.Packet): 8 | __hdr__ = ( 9 | ('proto_id', 'H', 0), 10 | ('v', 'B', 0), 11 | ('type', 'B', 0), 12 | ('flags', 'B', 0), 13 | ('root_id', '8s', ''), 14 | ('root_path', 'I', 0), 15 | ('bridge_id', '8s', ''), 16 | ('port_id', 'H', 0), 17 | ('age', 'H', 0), 18 | ('max_age', 'H', 0), 19 | ('hello', 'H', 0), 20 | ('fd', 'H', 0) 21 | ) 22 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/tns.py: -------------------------------------------------------------------------------- 1 | # $Id: tns.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Transparent Network Substrate.""" 4 | 5 | import dpkt 6 | 7 | class TNS(dpkt.Packet): 8 | __hdr__ = ( 9 | ('length', 'H', 0), 10 | ('pktsum', 'H', 0), 11 | ('type', 'B', 0), 12 | ('rsvd', 'B', 0), 13 | ('hdrsum', 'H', 0), 14 | ('msg', '0s', ''), 15 | ) 16 | def unpack(self, buf): 17 | dpkt.Packet.unpack(self, buf) 18 | n = self.length - self.__hdr_len__ 19 | if n > len(self.data): 20 | raise dpkt.NeedData('short message (missing %d bytes)' % 21 | (n - len(self.data))) 22 | self.msg = self.data[:n] 23 | self.data = self.data[n:] 24 | 25 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/tpkt.py: -------------------------------------------------------------------------------- 1 | # $Id: tpkt.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """ISO Transport Service on top of the TCP (TPKT).""" 4 | 5 | import dpkt 6 | 7 | # TPKT - RFC 1006 Section 6 8 | # http://www.faqs.org/rfcs/rfc1006.html 9 | 10 | class TPKT(dpkt.Packet): 11 | __hdr__ = ( 12 | ('v', 'B', 3), 13 | ('rsvd', 'B', 0), 14 | ('len', 'H', 0) 15 | ) 16 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/udp.py: -------------------------------------------------------------------------------- 1 | # $Id: udp.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """User Datagram Protocol.""" 4 | 5 | import dpkt 6 | 7 | UDP_PORT_MAX = 65535 8 | 9 | class UDP(dpkt.Packet): 10 | __hdr__ = ( 11 | ('sport', 'H', 0xdead), 12 | ('dport', 'H', 0), 13 | ('ulen', 'H', 8), 14 | ('sum', 'H', 0) 15 | ) 16 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/build/lib/dpkt/yahoo.py: -------------------------------------------------------------------------------- 1 | # $Id: yahoo.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Yahoo Messenger.""" 4 | 5 | import dpkt 6 | 7 | class YHOO(dpkt.Packet): 8 | __hdr__ = [ 9 | ('version', '8s', ' ' * 8), 10 | ('length', 'I', 0), 11 | ('service', 'I', 0), 12 | ('connid', 'I', 0), 13 | ('magic', 'I', 0), 14 | ('unknown', 'I', 0), 15 | ('type', 'I', 0), 16 | ('nick1', '36s', ' ' * 36), 17 | ('nick2', '36s', ' ' * 36) 18 | ] 19 | __byte_order__ = '<' 20 | 21 | class YMSG(dpkt.Packet): 22 | __hdr__ = [ 23 | ('version', '8s', ' ' * 8), 24 | ('length', 'H', 0), 25 | ('type', 'H', 0), 26 | ('unknown1', 'I', 0), 27 | ('unknown2', 'I', 0) 28 | ] 29 | 30 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/ah.py: -------------------------------------------------------------------------------- 1 | # $Id: ah.py 34 2007-01-28 07:54:20Z dugsong $ 2 | 3 | """Authentication Header.""" 4 | 5 | import dpkt 6 | 7 | class AH(dpkt.Packet): 8 | __hdr__ = ( 9 | ('nxt', 'B', 0), 10 | ('len', 'B', 0), # payload length 11 | ('rsvd', 'H', 0), 12 | ('spi', 'I', 0), 13 | ('seq', 'I', 0) 14 | ) 15 | auth = '' 16 | def unpack(self, buf): 17 | dpkt.Packet.unpack(self, buf) 18 | self.auth = self.data[:self.len] 19 | buf = self.data[self.len:] 20 | import ip 21 | try: 22 | self.data = ip.IP.get_proto(self.nxt)(buf) 23 | setattr(self, self.data.__class__.__name__.lower(), self.data) 24 | except (KeyError, dpkt.UnpackError): 25 | self.data = buf 26 | 27 | def __len__(self): 28 | return self.__hdr_len__ + len(self.auth) + len(self.data) 29 | 30 | def __str__(self): 31 | return self.pack_hdr() + str(self.auth) + str(self.data) 32 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/arp.py: -------------------------------------------------------------------------------- 1 | # $Id: arp.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Address Resolution Protocol.""" 4 | 5 | import dpkt 6 | 7 | # Hardware address format 8 | ARP_HRD_ETH = 0x0001 # ethernet hardware 9 | ARP_HRD_IEEE802 = 0x0006 # IEEE 802 hardware 10 | 11 | # Protocol address format 12 | ARP_PRO_IP = 0x0800 # IP protocol 13 | 14 | # ARP operation 15 | ARP_OP_REQUEST = 1 # request to resolve ha given pa 16 | ARP_OP_REPLY = 2 # response giving hardware address 17 | ARP_OP_REVREQUEST = 3 # request to resolve pa given ha 18 | ARP_OP_REVREPLY = 4 # response giving protocol address 19 | 20 | class ARP(dpkt.Packet): 21 | __hdr__ = ( 22 | ('hrd', 'H', ARP_HRD_ETH), 23 | ('pro', 'H', ARP_PRO_IP), 24 | ('hln', 'B', 6), # hardware address length 25 | ('pln', 'B', 4), # protocol address length 26 | ('op', 'H', ARP_OP_REQUEST), 27 | ('sha', '6s', ''), 28 | ('spa', '4s', ''), 29 | ('tha', '6s', ''), 30 | ('tpa', '4s', '') 31 | ) 32 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/dtp.py: -------------------------------------------------------------------------------- 1 | # $Id: dtp.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Dynamic Trunking Protocol.""" 4 | 5 | import struct 6 | import dpkt 7 | 8 | class DTP(dpkt.Packet): 9 | __hdr__ = ( 10 | ('v', 'B', 0), 11 | ) # rest is TLVs 12 | def unpack(self, buf): 13 | dpkt.Packet.unpack(self, buf) 14 | buf = self.data 15 | tvs = [] 16 | while buf: 17 | t, l = struct.unpack('>HH', buf[:4]) 18 | v, buf = buf[4:4+l], buf[4+l:] 19 | tvs.append((t, v)) 20 | self.data = tvs 21 | 22 | TRUNK_NAME = 0x01 23 | MAC_ADDR = 0x04 24 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/esp.py: -------------------------------------------------------------------------------- 1 | # $Id: esp.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Encapsulated Security Protocol.""" 4 | 5 | import dpkt 6 | 7 | class ESP(dpkt.Packet): 8 | __hdr__ = ( 9 | ('spi', 'I', 0), 10 | ('seq', 'I', 0) 11 | ) 12 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/hsrp.py: -------------------------------------------------------------------------------- 1 | # $Id: hsrp.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Cisco Hot Standby Router Protocol.""" 4 | 5 | import dpkt 6 | 7 | # Opcodes 8 | HELLO = 0 9 | COUP = 1 10 | RESIGN = 2 11 | 12 | # States 13 | INITIAL = 0x00 14 | LEARN = 0x01 15 | LISTEN = 0x02 16 | SPEAK = 0x04 17 | STANDBY = 0x08 18 | ACTIVE = 0x10 19 | 20 | class HSRP(dpkt.Packet): 21 | __hdr__ = ( 22 | ('version', 'B', 0), 23 | ('opcode', 'B', 0), 24 | ('state', 'B', 0), 25 | ('hello', 'B', 0), 26 | ('hold', 'B', 0), 27 | ('priority', 'B', 0), 28 | ('group', 'B', 0), 29 | ('rsvd', 'B', 0), 30 | ('auth', '8s', 'cisco'), 31 | ('vip', '4s', '') 32 | ) 33 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/igmp.py: -------------------------------------------------------------------------------- 1 | # $Id: igmp.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Internet Group Management Protocol.""" 4 | 5 | import dpkt 6 | 7 | class IGMP(dpkt.Packet): 8 | __hdr__ = ( 9 | ('type', 'B', 0), 10 | ('maxresp', 'B', 0), 11 | ('sum', 'H', 0), 12 | ('group', 'I', 0) 13 | ) 14 | def __str__(self): 15 | if not self.sum: 16 | self.sum = dpkt.in_cksum(dpkt.Packet.__str__(self)) 17 | return dpkt.Packet.__str__(self) 18 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/ipx.py: -------------------------------------------------------------------------------- 1 | # $Id: ipx.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Internetwork Packet Exchange.""" 4 | 5 | import dpkt 6 | 7 | IPX_HDR_LEN = 30 8 | 9 | class IPX(dpkt.Packet): 10 | __hdr__ = ( 11 | ('sum', 'H', 0xffff), 12 | ('len', 'H', IPX_HDR_LEN), 13 | ('tc', 'B', 0), 14 | ('pt', 'B', 0), 15 | ('dst', '12s', ''), 16 | ('src', '12s', '') 17 | ) 18 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/loopback.py: -------------------------------------------------------------------------------- 1 | # $Id: loopback.py 38 2007-03-17 03:33:16Z dugsong $ 2 | 3 | """Platform-dependent loopback header.""" 4 | 5 | import dpkt, ethernet, ip, ip6 6 | 7 | class Loopback(dpkt.Packet): 8 | __hdr__ = (('family', 'I', 0), ) 9 | __byte_order__ = '@' 10 | def unpack(self, buf): 11 | dpkt.Packet.unpack(self, buf) 12 | if self.family == 2: 13 | self.data = ip.IP(self.data) 14 | elif self.family == 0x02000000: 15 | self.family = 2 16 | self.data = ip.IP(self.data) 17 | elif self.family in (24, 28, 30): 18 | self.data = ip6.IP6(self.data) 19 | elif self.family > 1500: 20 | self.data = ethernet.Ethernet(self.data) 21 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/ospf.py: -------------------------------------------------------------------------------- 1 | # $Id: ospf.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Open Shortest Path First.""" 4 | 5 | import dpkt 6 | 7 | AUTH_NONE = 0 8 | AUTH_PASSWORD = 1 9 | AUTH_CRYPTO = 2 10 | 11 | class OSPF(dpkt.Packet): 12 | __hdr__ = ( 13 | ('v', 'B', 0), 14 | ('type', 'B', 0), 15 | ('len', 'H', 0), 16 | ('router', 'I', 0), 17 | ('area', 'I', 0), 18 | ('sum', 'H', 0), 19 | ('atype', 'H', 0), 20 | ('auth', '8s', '') 21 | ) 22 | def __str__(self): 23 | if not self.sum: 24 | self.sum = dpkt.in_cksum(dpkt.Packet.__str__(self)) 25 | return dpkt.Packet.__str__(self) 26 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/pim.py: -------------------------------------------------------------------------------- 1 | # $Id: pim.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Protocol Independent Multicast.""" 4 | 5 | import dpkt 6 | 7 | class PIM(dpkt.Packet): 8 | __hdr__ = ( 9 | ('v_type', 'B', 0x20), 10 | ('rsvd', 'B', 0), 11 | ('sum', 'H', 0) 12 | ) 13 | def _get_v(self): return self.v_type >> 4 14 | def _set_v(self, v): self.v_type = (v << 4) | (self.v_type & 0xf) 15 | v = property(_get_v, _set_v) 16 | 17 | def _get_type(self): return self.v_type & 0xf 18 | def _set_type(self, type): self.v_type = (self.v_type & 0xf0) | type 19 | type = property(_get_type, _set_type) 20 | 21 | def __str__(self): 22 | if not self.sum: 23 | self.sum = dpkt.in_cksum(dpkt.Packet.__str__(self)) 24 | return dpkt.Packet.__str__(self) 25 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/pmap.py: -------------------------------------------------------------------------------- 1 | # $Id: pmap.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Portmap / rpcbind.""" 4 | 5 | import dpkt 6 | 7 | PMAP_PROG = 100000L 8 | PMAP_PROCDUMP = 4 9 | PMAP_VERS = 2 10 | 11 | class Pmap(dpkt.Packet): 12 | __hdr__ = ( 13 | ('prog', 'I', 0), 14 | ('vers', 'I', 0), 15 | ('prot', 'I', 0), 16 | ('port', 'I', 0), 17 | ) 18 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/pppoe.py: -------------------------------------------------------------------------------- 1 | # $Id: pppoe.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """PPP-over-Ethernet.""" 4 | 5 | import dpkt, ppp 6 | 7 | # RFC 2516 codes 8 | PPPoE_PADI = 0x09 9 | PPPoE_PADO = 0x07 10 | PPPoE_PADR = 0x19 11 | PPPoE_PADS = 0x65 12 | PPPoE_PADT = 0xA7 13 | PPPoE_SESSION = 0x00 14 | 15 | class PPPoE(dpkt.Packet): 16 | __hdr__ = ( 17 | ('v_type', 'B', 0x11), 18 | ('code', 'B', 0), 19 | ('session', 'H', 0), 20 | ('len', 'H', 0) # payload length 21 | ) 22 | def _get_v(self): return self.v_type >> 4 23 | def _set_v(self, v): self.v_type = (v << 4) | (self.v_type & 0xf) 24 | v = property(_get_v, _set_v) 25 | 26 | def _get_type(self): return self.v_type & 0xf 27 | def _set_type(self, t): self.v_type = (self.v_type & 0xf0) | t 28 | type = property(_get_type, _set_type) 29 | 30 | def unpack(self, buf): 31 | dpkt.Packet.unpack(self, buf) 32 | try: 33 | if self.code == 0: 34 | self.data = self.ppp = ppp.PPP(self.data) 35 | except dpkt.UnpackError: 36 | pass 37 | 38 | # XXX - TODO TLVs, etc. 39 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/sip.py: -------------------------------------------------------------------------------- 1 | # $Id: sip.py 48 2008-05-27 17:31:15Z yardley $ 2 | 3 | """Session Initiation Protocol.""" 4 | 5 | import http 6 | 7 | class Request(http.Request): 8 | """SIP request.""" 9 | __hdr_defaults__ = { 10 | 'method':'INVITE', 11 | 'uri':'sip:user@example.com', 12 | 'version':'2.0', 13 | 'headers':{ 'To':'', 'From':'', 'Call-ID':'', 'CSeq':'', 'Contact':'' } 14 | } 15 | __methods = dict.fromkeys(( 16 | 'ACK', 'BYE', 'CANCEL', 'INFO', 'INVITE', 'MESSAGE', 'NOTIFY', 17 | 'OPTIONS', 'PRACK', 'PUBLISH', 'REFER', 'REGISTER', 'SUBSCRIBE', 18 | 'UPDATE' 19 | )) 20 | __proto = 'SIP' 21 | 22 | class Response(http.Response): 23 | """SIP response.""" 24 | __hdr_defaults__ = { 25 | 'version':'2.0', 26 | 'status':'200', 27 | 'reason':'OK', 28 | 'headers':{ 'To':'', 'From':'', 'Call-ID':'', 'CSeq':'', 'Contact':'' } 29 | } 30 | __proto = 'SIP' 31 | 32 | 33 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/sll.py: -------------------------------------------------------------------------------- 1 | # $Id: sll.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Linux libpcap "cooked" capture encapsulation.""" 4 | 5 | import arp, dpkt, ethernet 6 | 7 | class SLL(dpkt.Packet): 8 | __hdr__ = ( 9 | ('type', 'H', 0), # 0: to us, 1: bcast, 2: mcast, 3: other, 4: from us 10 | ('hrd', 'H', arp.ARP_HRD_ETH), 11 | ('hlen', 'H', 6), # hardware address length 12 | ('hdr', '8s', ''), # first 8 bytes of link-layer header 13 | ('ethtype', 'H', ethernet.ETH_TYPE_IP), 14 | ) 15 | _typesw = ethernet.Ethernet._typesw 16 | 17 | def unpack(self, buf): 18 | dpkt.Packet.unpack(self, buf) 19 | try: 20 | self.data = self._typesw[self.ethtype](self.data) 21 | setattr(self, self.data.__class__.__name__.lower(), self.data) 22 | except (KeyError, dpkt.UnpackError): 23 | pass 24 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/smb.py: -------------------------------------------------------------------------------- 1 | # $Id: smb.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Server Message Block.""" 4 | 5 | import dpkt 6 | 7 | class SMB(dpkt.Packet): 8 | __hdr__ = [ 9 | ('proto', '4s', ''), 10 | ('cmd', 'B', 0), 11 | ('err', 'I', 0), 12 | ('flags1', 'B', 0), 13 | ('flags2', 'B', 0), 14 | ('pad', '6s', ''), 15 | ('tid', 'H', 0), 16 | ('pid', 'H', 0), 17 | ('uid', 'H', 0), 18 | ('mid', 'H', 0) 19 | ] 20 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/stp.py: -------------------------------------------------------------------------------- 1 | # $Id: stp.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Spanning Tree Protocol.""" 4 | 5 | import dpkt 6 | 7 | class STP(dpkt.Packet): 8 | __hdr__ = ( 9 | ('proto_id', 'H', 0), 10 | ('v', 'B', 0), 11 | ('type', 'B', 0), 12 | ('flags', 'B', 0), 13 | ('root_id', '8s', ''), 14 | ('root_path', 'I', 0), 15 | ('bridge_id', '8s', ''), 16 | ('port_id', 'H', 0), 17 | ('age', 'H', 0), 18 | ('max_age', 'H', 0), 19 | ('hello', 'H', 0), 20 | ('fd', 'H', 0) 21 | ) 22 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/tns.py: -------------------------------------------------------------------------------- 1 | # $Id: tns.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Transparent Network Substrate.""" 4 | 5 | import dpkt 6 | 7 | class TNS(dpkt.Packet): 8 | __hdr__ = ( 9 | ('length', 'H', 0), 10 | ('pktsum', 'H', 0), 11 | ('type', 'B', 0), 12 | ('rsvd', 'B', 0), 13 | ('hdrsum', 'H', 0), 14 | ('msg', '0s', ''), 15 | ) 16 | def unpack(self, buf): 17 | dpkt.Packet.unpack(self, buf) 18 | n = self.length - self.__hdr_len__ 19 | if n > len(self.data): 20 | raise dpkt.NeedData('short message (missing %d bytes)' % 21 | (n - len(self.data))) 22 | self.msg = self.data[:n] 23 | self.data = self.data[n:] 24 | 25 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/tpkt.py: -------------------------------------------------------------------------------- 1 | # $Id: tpkt.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """ISO Transport Service on top of the TCP (TPKT).""" 4 | 5 | import dpkt 6 | 7 | # TPKT - RFC 1006 Section 6 8 | # http://www.faqs.org/rfcs/rfc1006.html 9 | 10 | class TPKT(dpkt.Packet): 11 | __hdr__ = ( 12 | ('v', 'B', 3), 13 | ('rsvd', 'B', 0), 14 | ('len', 'H', 0) 15 | ) 16 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/udp.py: -------------------------------------------------------------------------------- 1 | # $Id: udp.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """User Datagram Protocol.""" 4 | 5 | import dpkt 6 | 7 | UDP_PORT_MAX = 65535 8 | 9 | class UDP(dpkt.Packet): 10 | __hdr__ = ( 11 | ('sport', 'H', 0xdead), 12 | ('dport', 'H', 0), 13 | ('ulen', 'H', 8), 14 | ('sum', 'H', 0) 15 | ) 16 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/dpkt/yahoo.py: -------------------------------------------------------------------------------- 1 | # $Id: yahoo.py 23 2006-11-08 15:45:33Z dugsong $ 2 | 3 | """Yahoo Messenger.""" 4 | 5 | import dpkt 6 | 7 | class YHOO(dpkt.Packet): 8 | __hdr__ = [ 9 | ('version', '8s', ' ' * 8), 10 | ('length', 'I', 0), 11 | ('service', 'I', 0), 12 | ('connid', 'I', 0), 13 | ('magic', 'I', 0), 14 | ('unknown', 'I', 0), 15 | ('type', 'I', 0), 16 | ('nick1', '36s', ' ' * 36), 17 | ('nick2', '36s', ' ' * 36) 18 | ] 19 | __byte_order__ = '<' 20 | 21 | class YMSG(dpkt.Packet): 22 | __hdr__ = [ 23 | ('version', '8s', ' ' * 8), 24 | ('length', 'H', 0), 25 | ('type', 'H', 0), 26 | ('unknown1', 'I', 0), 27 | ('unknown2', 'I', 0) 28 | ] 29 | 30 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from distutils.core import setup 4 | import dpkt 5 | 6 | setup(name='dpkt', 7 | version=dpkt.__version__, 8 | author=dpkt.__author__, 9 | url=dpkt.__url__, 10 | description='dumb packet module', 11 | packages=[ 'dpkt' ]) 12 | -------------------------------------------------------------------------------- /pycapreplay/dpkt/tests/test-perf2.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import dpkt 4 | import time, unittest 5 | 6 | class TestPerf(unittest.TestCase): 7 | rounds = 10000 8 | 9 | def setUp(self): 10 | self.start = time.time() 11 | def tearDown(self): 12 | print self.rounds / (time.time() - self.start), 'rounds/s' 13 | 14 | def test_pack(self): 15 | for i in xrange(self.rounds): 16 | str(dpkt.ip.IP()) 17 | print 'pack:', 18 | 19 | def test_unpack(self): 20 | buf = str(dpkt.ip.IP()) 21 | for i in xrange(self.rounds): 22 | dpkt.ip.IP(buf) 23 | print 'unpack:', 24 | 25 | if __name__ == '__main__': 26 | unittest.main() 27 | -------------------------------------------------------------------------------- /pycapreplay/pypcap/.svn/entries: -------------------------------------------------------------------------------- 1 | 12 2 | -------------------------------------------------------------------------------- /pycapreplay/pypcap/.svn/format: -------------------------------------------------------------------------------- 1 | 12 2 | -------------------------------------------------------------------------------- /pycapreplay/pypcap/.svn/wc.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/pycapreplay/pypcap/.svn/wc.db -------------------------------------------------------------------------------- /pycapreplay/pypcap/AUTHORS: -------------------------------------------------------------------------------- 1 | 2 | Dug Song 3 | Bartosz Skowron 4 | -------------------------------------------------------------------------------- /pycapreplay/pypcap/CHANGES: -------------------------------------------------------------------------------- 1 | pypcap-trunk: 2 | 3 | - honor 'immediate' flag to disable buffering under Windows - by Kosma Moczek 4 | 5 | - sendpacket() support - by Kosma Moczek 6 | 7 | - API CHANGE: require 'cnt' as first parameter to pcap.loop() 8 | - by Bartosz Skowron 9 | 10 | - lookupnet() support - from Joao Medeiros 11 | 12 | - findalldevs() support - by Bartosz Skowron 13 | 14 | pypcap-1.1: 15 | 16 | - better lookupdev() on win32, as requested by Zack Payton 17 | 18 | 19 | - add Linux SLL datalink type 20 | 21 | - better threading support from A. Nonymous 22 | 23 | pypcap-1.0: 24 | 25 | - API CHANGE: require 'cnt' as first parameter to pcap.dispatch(), 26 | shadowing libpcap pcap_dispatch(). 27 | 28 | - add pcap.{get,set}nonblock(), to work around broken BPF select() 29 | on certain platforms (MacOS X, older FreeBSD, etc.). 30 | 31 | # $Id: CHANGES 101 2010-07-16 08:20:16Z kosma@kosma.pl $ 32 | -------------------------------------------------------------------------------- /pycapreplay/pypcap/Makefile: -------------------------------------------------------------------------------- 1 | # $Id: Makefile 102 2010-07-17 19:07:07Z kosma@kosma.pl $ 2 | 3 | PYTHON = python2 4 | #CONFIG_ARGS = --with-pcap=$(HOME)/build/libpcap-0.8.3 5 | 6 | # PYTHON = C:\\Python23\\python.exe 7 | # CONFIG_ARGS = --with-pcap=..\\wpdpack 8 | 9 | PKGDIR = pypcap-`egrep version setup.py | cut -f2 -d"'"` 10 | URL = `egrep url setup.py | cut -f2 -d"'"` 11 | 12 | all: pcap.c 13 | $(PYTHON) setup.py config $(CONFIG_ARGS) 14 | $(PYTHON) setup.py build 15 | 16 | pcap.c: pcap.pyx 17 | pyrexc pcap.pyx 18 | 19 | install: 20 | $(PYTHON) setup.py install 21 | 22 | test: 23 | $(PYTHON) test.py 24 | 25 | doc: 26 | epydoc -o doc -n pcap -u $(URL) --docformat=plaintext pcap 27 | 28 | pkg_win32: 29 | $(PYTHON) setup.py bdist_wininst 30 | 31 | pkg_osx: 32 | bdist_mpkg --readme=README --license=LICENSE 33 | mv dist $(PKGDIR) 34 | hdiutil create -srcfolder $(PKGDIR) $(PKGDIR).dmg 35 | mv $(PKGDIR) dist 36 | 37 | clean: 38 | $(PYTHON) setup.py clean 39 | rm -rf build dist 40 | 41 | cleandir distclean: clean 42 | $(PYTHON) setup.py clean -a 43 | rm -f config.h *~ 44 | 45 | # mingw32-make fix 46 | .PHONY: install 47 | -------------------------------------------------------------------------------- /pycapreplay/pypcap/README: -------------------------------------------------------------------------------- 1 | 2 | Python pcap module 3 | ------------------ 4 | 5 | This is a simplified object-oriented Python wrapper for libpcap - 6 | the current tcpdump.org version, and the WinPcap port for Windows. 7 | 8 | example use: 9 | 10 | >>> import pcap 11 | >>> for ts, pkt in pcap.pcap(): 12 | ... print ts, `pkt` 13 | ... 14 | 15 | Building 16 | -------- 17 | 18 | Just try 'make', and then 'make install' 19 | 20 | If your libpcap installation is missing the pcap-int.h header, you 21 | will need to build against a libpcap build directory. Modify the 22 | CONFIG_ARGS in the Makefile to point to the location of your built 23 | libpcap distribution, and try again. 24 | 25 | See INSTALL file for more detailed build instructions. 26 | 27 | Support 28 | ------- 29 | 30 | Visit http://code.google.com/p/pypcap for help! 31 | 32 | -------------------------------------------------------------------------------- /pycapreplay/pypcap/build/lib.linux-x86_64-2.7/pcap.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/pycapreplay/pypcap/build/lib.linux-x86_64-2.7/pcap.so -------------------------------------------------------------------------------- /pycapreplay/pypcap/build/temp.linux-x86_64-2.7/pcap.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/pycapreplay/pypcap/build/temp.linux-x86_64-2.7/pcap.o -------------------------------------------------------------------------------- /pycapreplay/pypcap/build/temp.linux-x86_64-2.7/pcap_ex.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/pycapreplay/pypcap/build/temp.linux-x86_64-2.7/pcap_ex.o -------------------------------------------------------------------------------- /pycapreplay/pypcap/config.h: -------------------------------------------------------------------------------- 1 | #define HAVE_PCAP_SETNONBLOCK 1 2 | #define HAVE_PCAP_FILE 1 3 | #define HAVE_PCAP_COMPILE_NOPCAP 1 4 | -------------------------------------------------------------------------------- /pycapreplay/pypcap/config.pkl: -------------------------------------------------------------------------------- 1 | (dp1 2 | S'libraries' 3 | p2 4 | (lp3 5 | S'pcap' 6 | p4 7 | asS'library_dirs' 8 | p5 9 | (lp6 10 | S'/usr/lib' 11 | p7 12 | asS'include_dirs' 13 | p8 14 | (lp9 15 | S'/usr/include/pcap' 16 | p10 17 | as. -------------------------------------------------------------------------------- /pycapreplay/pypcap/pcap_ex.h: -------------------------------------------------------------------------------- 1 | /* $Id: pcap_ex.h 64 2005-08-29 21:11:40Z dugsong $ */ 2 | 3 | #ifndef PCAP_EX_H 4 | #define PCAP_EX_H 5 | 6 | int pcap_ex_immediate(pcap_t *pcap); 7 | char *pcap_ex_name(char *name); 8 | char *pcap_ex_lookupdev(char *ebuf); 9 | int pcap_ex_fileno(pcap_t *pcap); 10 | void pcap_ex_setup(pcap_t *pcap); 11 | void pcap_ex_setnonblock(pcap_t *pcap, int nonblock, char *ebuf); 12 | int pcap_ex_getnonblock(pcap_t *pcap, char *ebuf); 13 | int pcap_ex_next(pcap_t *pcap, struct pcap_pkthdr **hdr, u_char **pkt); 14 | int pcap_ex_compile_nopcap(int snaplen, int dlt, struct bpf_program *fp, 15 | char *str, int optimize, unsigned int netmask); 16 | 17 | #endif /* PCAP_EX_H */ 18 | -------------------------------------------------------------------------------- /pycapreplay/pypcap/test.pcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/pycapreplay/pypcap/test.pcap -------------------------------------------------------------------------------- /pycapreplay/pypcap/testsniff.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import getopt, sys 4 | import dpkt, pcap 5 | 6 | def usage(): 7 | print >>sys.stderr, 'usage: %s [-i device] [pattern]' % sys.argv[0] 8 | sys.exit(1) 9 | 10 | def main(): 11 | opts, args = getopt.getopt(sys.argv[1:], 'i:h') 12 | name = None 13 | for o, a in opts: 14 | if o == '-i': name = a 15 | else: usage() 16 | 17 | pc = pcap.pcap(name) 18 | pc.setfilter(' '.join(args)) 19 | decode = { pcap.DLT_LOOP:dpkt.loopback.Loopback, 20 | pcap.DLT_NULL:dpkt.loopback.Loopback, 21 | pcap.DLT_EN10MB:dpkt.ethernet.Ethernet }[pc.datalink()] 22 | try: 23 | print 'listening on %s: %s' % (pc.name, pc.filter) 24 | for ts, pkt in pc: 25 | print ts, `decode(pkt)` 26 | except KeyboardInterrupt: 27 | nrecv, ndrop, nifdrop = pc.stats() 28 | print '\n%d packets received by filter' % nrecv 29 | print '%d packets dropped by kernel' % ndrop 30 | 31 | if __name__ == '__main__': 32 | main() 33 | -------------------------------------------------------------------------------- /pycapreplay/replay.py: -------------------------------------------------------------------------------- 1 | 2 | import pcap 3 | import dpkt 4 | import sys 5 | import socket 6 | 7 | def usage(): 8 | print "python replay.py " 9 | sys.exit(1) 10 | 11 | def replay(pkts, fromip, toip): 12 | 13 | print "import socket" 14 | print "s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)" 15 | print "s.connect(('%s', %d))" % ('127.0.0.1', 23) 16 | for t, p in pkts: 17 | eth = dpkt.ethernet.Ethernet(p) 18 | ip = eth.ip 19 | tcp = ip.tcp 20 | if ip.src == fromip and ip.dst == toip and len(ip.tcp.data) > 0: 21 | print "s.send(b'%s')" % repr(ip.tcp.data) 22 | elif ip.src == toip and ip.dst == fromip and len(ip.tcp.data) > 0: 23 | print "s.recv(%u)" % len(ip.tcp.data) 24 | print "s.close()" 25 | 26 | def main(argv): 27 | if len(argv) != 3: 28 | usage() 29 | 30 | replay(pcap.pcap(argv[0]), socket.inet_aton(argv[1]), socket.inet_aton(argv[2])) 31 | 32 | if __name__ == '__main__': 33 | main(sys.argv[1:]) 34 | 35 | -------------------------------------------------------------------------------- /pycapreplay/setup.sh: -------------------------------------------------------------------------------- 1 | export PYTHONPATH=`pwd`/pypcap/build/lib.linux-x86_64-2.7/:`pwd`/dpkt/ 2 | -------------------------------------------------------------------------------- /pycapreplay/telnet.pcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/clem1/segvault/bd6240c4d8b6c23e5bcdd75c7f20330cf4b5d450/pycapreplay/telnet.pcap -------------------------------------------------------------------------------- /untidy/README: -------------------------------------------------------------------------------- 1 | untidy - XML Fuzzer 2 | =================== 3 | 4 | More info at 5 | ============ 6 | 7 | http://untidy.sourceforge.net/ 8 | 9 | Usage 10 | ===== 11 | 12 | import untidy 13 | 14 | xmlString = 'f00!' 15 | 16 | xf = untidy.xmlFuzzer() 17 | xf.setRepetitions( [3,30,60] ) 18 | iter = xf.fuzz( xmlString ) 19 | 20 | for i in iter: 21 | print i 22 | 23 | License 24 | ======= 25 | 26 | GPL v2 27 | 28 | Credits 29 | ======= 30 | 31 | andres =dot= riancho @ gmail !dot! com 32 | --------------------------------------------------------------------------------