Search the Community
Showing results for tags 'perl'.
-
https://rapidshare.cc/getfile/code/86df737db1b384806061de21b243acaf How This Book Is Structured Each chapter in this book addresses a different system administration domain and ends with a list of the Perl modules used in that chapter and references to facilitate deeper exploration of the information presented. The chapters are as follows: Chapter 1, Introduction This introductory chapter describes the material covered in the book in more detail, explaining how it will serve you and what you need to get the most from it. The material in this book is powerful and is meant to be used by powerful people (e.g., Unix superusers and Windows-based operating system administrators). The introduction provides some important guidelines to help you write more secure Perl programs. Chapter 2, Filesystems This chapter is about keeping multiplatform filesystems tidy and ensuring that they are used properly. We’ll start by looking at the salient differences between the native filesystems for each operating system. We’ll then explore the process of xvi | Preface Download at Boykma.Com intelligently walking or traversing filesystems from Perl and how that can be useful. Finally, we’ll look at manipulating disk quotas from Perl. Chapter 3, User Accounts This chapter discusses how user accounts manifest themselves on two different operating systems, including what is stored for each user and how to manipulate the information from Perl. That leads into a discussion of a rudimentary account system written in Perl. In the process of building this system, we’ll examine the mechanisms necessary for recording accounts in a simple database, creating these accounts, and deleting them. Chapter 4, User Activity Chapter 4 explores ways to automate tasks centered around user activity, intro- ducing a number of ways to track and control process, file, and network operations initiated by users. This chapter also presents various operating system-specific frameworks and tools (e.g., Windows Management Instrumentation, GUI setup tools, lsof, etc.) that are helpful for user-oriented tasks on different platforms. Chapter 5, TCP/IP Name and Configuration Services Name and configuration services allow hosts on a TCP/IP network to communicate with each other amicably and to self-configure. This chapter takes a historical per- spective by starting with host files, then moving on to the Network Information Service (NIS) and finally to the glue of the Internet, the Domain Name Service (DNS). Each step of the way, it shows how Perl can make professional management of these services easier. We’ll also explore how to work with the Dynamic Host Configuration Protocol (DHCP) from Perl in this chapter. Chapter 6, Working with Configuration Files Almost every system or software package we touch relies heavily on configuration files to be useful in our environment. This chapter explores the tools that make writing and reading those files from Perl easy. We’ll look at various formats, with special attention paid to XML and the current best practices for working with it using Perl. Chapter 7, SQL Database Administration Over time, more uses for relational databases are being found in the system ad- ministration realm. As a result, system administrators need to become familiar with SQL database administration. This chapter explains DBI, the preeminent SQL database framework for Perl, and provides examples of it in action for database administration. Chapter 8, Email This chapter demonstrates how Perl can make better use of email as a system ad- ministration tool. After discussing sending via SMTP (including MIME-based HTML messages), receiving via POP3/IMAP, and parsing via Perl, we’ll explore several interesting applications, including tools for analyzing unsolicited commer- cial email (a.k.a. spam) and managing tech support emails. Preface | xvii Download at Boykma.Com Chapter 9, Directory Services As the complexity of the information we deal with increases over time, so does the importance of the directory services we use to access that information. System administrators are increasingly being called upon not only to use these services, but also to build tools for their management. This chapter discusses some of the more popular directory service protocols/frameworks, such as LDAP and ADSI, and shows you how to work with them from Perl. Chapter 10, Log Files System administrators are often awash in a sea of log files. Every machine, operating system, and program can (and often does) log information. This chapter looks at the logging systems offered by Unix- and Windows-based operating systems and discusses approaches for analyzing logging information so it can work for you. Chapter 11, Security This chapter heads right into the maelstrom called “security,” demonstrating how Perl can make hosts and networks more secure. Chapter 12, SNMP This chapter is devoted to the Simple Network Management Protocol (SNMP). It illustrates how to use this protocol to communicate with network devices (both to poll and to receive trap information). Chapter 13, Network Mapping and Monitoring Perl offers some excellent tools for the mapping and monitoring of networks. In this chapter, we’ll look at several ways to discover the hosts on the network and the services they offer. We’ll then explore helpful graphical and textual ways to present the information collected, including some of the best tools for graphing and charting the data (such as GraphViz and RRDtool). Chapter 14, Experiential Learning This is the chapter you don’t want your boss to catch you reading. Appendixes Some of the chapters assume basic knowledge about topics with which you may not be familiar. For those who are new to these subjects, this book includes several mini-tutorials to bring you up to speed quickly. The appendixes provide introduc- tions to the eXtensible Markup Language (XML), the XML Path Language (XPath), the Lightweight Directory Access Protocol (LDAP), the Structured Query Lan- guage (SQL), the Revision Control System (RCS), translating VBScript to Perl, and SNMP.
-
Bun? ziua , a? dori ?i eu dac? se poate un script scris în perl care s?'mi acorde acces root la un website , adic? s? am acces la tot ce de?ine firma de la care detin webhostul pe respectivul dedicat , vps etc... Am auzit c? exist? un shell scris în perl ce'?i permite acest lucru , l'am avut mai demult dar printre timp l'am pierdut...Folosesc un shell php prin care am doar acces limitat(am acces root dar e doar la userul meu)
-
Am nevoie de cineva care stie perl si ma poate ajuta cu un mic script in schimbul sumei de 50$. Plata pe Paypal dupa ce verific scriptul. Detalii: pana acum, scriptul citeste niste URL-uri (toate sunt link-uri catre poze) dintr-un fisier. va exista o variabila @images si voi folosi foreach(@images){} pentru a parcurge fiecare imagine din array. Explicatie: Pentru fiecare imagine vreau sa verific: daca exista text in ea sau nu sa aflu daca textul contine doar numere / simboluri sa verific cu un regex daca un string se afla in textul respectiv CONDITII: daca exista text in poza -> retunam textul. Daca nu exista, returnam FALSE daca textul contine doar cifre / simboluri -> returnam TRUE . In oricare alta situatie returnam FALSE daca in text nu exista stringul din conditia pusa in regex, returnam TRUE. Daca exista, returnam FALSE Deci practic, pentru fiecare iteratie se va intampla cam asa: foreach (@images) { # verificare daca exista text in poza si returneaza acel text daca exista # textul din imagine poate contine caractere din limba chineza/japoneza $url = $_; $string = &imageCheck($url); $valid = &textCheck($string); if ($valid) { print "Valid: "; } else { print "Invalid: "; } print "$string / $url\n"; } sub imageCheck { # aici vreau sa se verifice daca textul gasit in poza contine DOAR numere si simboluri (ex: 21/02/2014 sau 3*30%) # daca URL-ul imaginii nu exista sau link-ul # ne da access forbidden, returneaza string value "404" sau "403" } sub textCheck { # aici se face o verificare. Daca text-ul nu se potriveste cu un regex,, returneaza TRUE }
-
RooT Flood + PERL 1. vps Ukrainian data center. VPS Hosting. 2. 10 minute 10 Minute Mail 2. perl esl.pl http://andreyesl.16mb.com/esl.pl Like and subscribe ! THANKS!!! https://www.youtube.com/watch?v=AFmPVdAB4kY
-
Configuring libcurl 7.41.0 with OpenSSL for Visual Studio 2013 In this tutorial I will go over configuring Visual Studio for seamless usage with the libcurl 7.41.0 and OpenSSL libraries. I have included references to articles found related to the compilation and common issues. What is curl? curl is a command line tool and library for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMTP, SMTPS, Telnet and TFTP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, HTTP/2, cookies, user+password authentication (Basic, Plain, Digest, CRAM-MD5, NTLM, Negotiate and Kerberos), file transfer resume, proxy tunneling and more. Required tools & libraries 1.] Visual Studio 2013 for Desktop (Ultimate, Team, etc) 2.] ActivePerl 5.20.1 3.] 7-Zip 9.20 for Extracting tar.gz 4.] OpenSSL 1.0.2 5.] curl 7.41.0 Compiling OpenSSL static libraries OpenSSL has made it quite easy with integrating Perl and Visual Studio to compile right from the Visual Studio Command Prompt. 1.] Verify ActivePerl 5.20.1 and Visual Studio 2013 are correctly installed. 2.] Download and extract OpenSSL with 7-Zip, in this example we will use: C:\openssl 3.] Open the Visual Studio Developer Command Prompt 4.] Start -> All Programs -> Visual Studio 2013 -> Visual Studio Tools -> Developer Command Prompt for VS2013 5.] Make sure to run as administrator in case there any file permission errors while executing Perl Now, we are ready to configure OpenSSL, as said there is no major changes that need made to make this function without issue. We have a few options depending on the specifics of your target base, in this case, I am going to deploy 32 bit static libraries as they work fine on the x64 based processor line. 1.] In the command prompt, change to the directory you extracted OpenSSL, I used c:\openssl. 2.] cd c:\openssl Type the build that best suits your needs, you can just copy the following and it should execute without problem. Building the 32-bit static libraries perl Configure VC-WIN32 --prefix=C:\Build-OpenSSL-VC-32 ms\do_ms nmake -f ms\nt.mak nmake -f ms\nt.mak install Building the 32-bit static libraries with debug symbols perl Configure debug-VC-WIN32 --prefix=C:\Build-OpenSSL-VC-32-dbg ms\do_ms nmake -f ms\nt.mak nmake -f ms\nt.mak install Building the 64-bit static libraries perl Configure VC-WIN64A --prefix=C:\Build-OpenSSL-VC-64 ms\do_win64a nmake -f ms\nt.mak nmake -f ms\nt.mak install Building the 64-bit static libraries with debug symbols perl Configure debug-VC-WIN64A --prefix=C:\Build-OpenSSL-VC-64-dbg ms\do_win64a nmake -f ms\nt.mak nmake -f ms\nt.mak install After executing it may take a minute, but will output your includes and static libraries afterwords. perl util/copy.pl "out32\openssl.exe C:\Build-OpenSSL-VC-32\bin" Copying: out32/openssl.exe to C:/Build-OpenSSL-VC-32/bin/openssl.exe perl util/mkdir-p.pl "C:\Build-OpenSSL-VC-32\ssl" created directory `C:/Build-OpenSSL-VC-32/ssl' perl util/copy.pl apps\openssl.cnf "C:\Build-OpenSSL-VC-32\ssl" Copying: apps/openssl.cnf to C:/Build-OpenSSL-VC-32/ssl/openssl.cnf perl util/copy.pl "out32\ssleay32.lib" "C:\Build-OpenSSL-VC-32\lib" Copying: out32/ssleay32.lib to C:/Build-OpenSSL-VC-32/lib/ssleay32.lib perl util/copy.pl "out32\libeay32.lib" "C:\Build-OpenSSL-VC-32\lib" Copying: out32/libeay32.lib to C:/Build-OpenSSL-VC-32/lib/libeay32.lib Note: * If you are trying to link your libraries and receive an error relating to ml64, then your Visual Studio isn't configured as x64, you will need to go in the OpenSSL folder and delete the tmp32 folder and recompile as a 32 bit library, if this folder is not deleted you will continue to receive errors. 1.] After it's compiled, go to the output directory, example, C:\Build-OpenSSL-VC-32. 2.] Open your Visual Studio C directory, example, C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC. 3.] Copy and merge the 'lib' and 'include' directory from the OpenSSL output directory into the 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC' directory. You are done with the OpenSSL portion. Compiling libcurl static libraries Now, that you have that done. We will need to configure libcurl. It has been made quite simple if you download the latest build, it comes with Visual Studio 2013 projects included. 1.] Extract libcurl 2.] Open libcurl folder, then go to: projects -> Windows -> VC12 3.] Open 'curl-all.sln' 4.] Go to Build -> Uncheck 'curlsrc' as we don't need this. 5.] Under 'libcurl', Choose LIB Release - LIB OpenSSL, as it will bind a static library that does not require exported DLLs. After it's done compiling, go to the 'curl-7.41.0' directory. Copy and merge the 'include' folder from there with 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC' as we did in the previous steps while setting up OpenSSL. There will also be a 'build' folder in the root of the 'curl-7.41.0' directory. build -> Win32 -> VC12 -> LIB Release - LIB OpenSSL Copy the file 'libcurl.lib' into the 'lib' folder located at 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC'. Since these are static libraries, not all functions from Windows have been previously exported. You will still need to link against 'Ws2_32.lib' and 'Wldap32.lib' for specific functions of 'libcurl' in Visual Studio, however you will not need any external DLL files. Make sure to define 'CURL_STATICLIB' in your Preprocessor Definitions. If you are having linker errors, try going to your Project Properties -> Linker -> Additional Dependencies in your Visual Studio project. Add the following: libcurl.lib libeay32.lib ssleay32.lib ws2_32.lib wldap32.lib You should be good to go after this. Example source for Visual Studio 2013.. #include "stdafx.h" #include <windows.h> #include <stdio.h> #include <curl\curl.h> int main(void) { CURL *curl; CURLcode res; curl = curl_easy_init(); if (curl) { curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); /* example.com is redirected, so we tell libcurl to follow redirection */ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); /* Perform the request, res will get the return code */ res = curl_easy_perform(curl); /* Check for errors */ if (res != CURLE_OK) fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); /* always cleanup */ curl_easy_cleanup(curl); } return 0; } References: http://developer.covenanteyes.com/building-openssl-for-visual-studio/ Source: sludg3 @ TF
-
ssh2ftpcrack is a simple FTP and SSH dictionary brute force cracking tool written in Perl. Author: GhOsT-PR #puerto.ghost.rico@gmail.com README: Steps: 1) Install libssh2( http://www.libssh2.org/ ) before installing Net::SSH2 2) Before installing Net::SSH2, install YAML 3) Type at the konsole as root: cpan YAML && cpan Net::SSH2 Now you are ready to use ssh2ftpcrack Usage: ssh2ftpcrack.pl [ftp or ssh] [user] [host] [wordlist] Download SSH2FTPCrack FTP / SSH Brute Forcer 0.2 ? Packet Storm
- 1 reply
-
- perl
- ssh brute forcer
-
(and 1 more)
Tagged with:
-
Advanced Perl Programming, 2nd Edition [2005] Extending and Embedding Perl [2003] Extreme Perl [2004] Higher-Order Perl: Transforming Programs with Programs [2005] Mastering Algorithms with Perl [1999] Mastering Perl [2007] Perl Debugged [2001] Perl Testing: A Developer's Notebook [2005] Practical mod_perl [2003] Pro Perl Debugging: From Professional to Expert [2005] Writing Perl Modules for CPAN [2002] Perl Medic: Transforming Legacy Code [2004] Perl Best Practices [2005] Effective Perl Programming: Ways to Write Better, More Idiomatic Perl (2nd Edition) [2010] request download ticket | Perl1.7z - ifile.it --- Beginning Perl [2000] Games Diversions & Perl Culture: Best of the Perl Journal [2004] Impatient Perl [2010] Intermediate Perl [2006] Learning Perl, Sixth Edition [2011] Learning Perl Objects, References & Modules [2003] Learning Perl on Win32 [1997] Learning Perl the Hard Way [2003] Modern Perl [2010] Object Oriented Perl [2000] Perl 5 Pocket Reference, 3rd Edition: Programming Tools [2000] Perl 6 and Parrot Essentials, 2nd Edition [2004] Perl Cookbook, 2nd Edition [2003] Perl Developer's Dictionary [2002] Perl for Beginners [2010] Perl Hacks [2006] Perl in a Nutshell, 2nd Edition [2002] Perl Power! - The Comprehensive Guide [2006] Perl Programmers Reference Guide [1998] Perl - The Complete Reference, 2nd Edition [2001] Professional Perl Programming [2001] Teach Yourself Perl in 24 Hours, 3rd Edition [2005] The Perl CD Bookshelf 4.0 Wicked Cool Perl Scripts [2006] Automating Windows with Perl [1999] Minimal Perl For UNIX and Linux People [2007] Automating System Administration with Perl, 2nd Edition [2009] request download ticket | Perl2.7z - ifile.it --- Learning Perl/Tk [1999] Mastering Perl/Tk [2002] Graphics Programming with Perl [2002] Beginning Web Development with Perl: From Novice to Professional [2006] Catalyst 5.8 - The Perl MVC Framework [2009] Catalyst - Accelerating Perl Web Application Development [2007] MySQL and Perl for the Web [2001] Network Programming with Perl [2000] Perl & LWP [2002] Perl Database Programming [2003] Perl for Oracle DBAs [2002] Practical mod_perl [2003] Programming the Network With Perl [2002] Programming the Perl DBI [2000] Programming Web Services with Perl [2002] Spidering Hacks [2003] The Definitive Guide to Catalyst: Writing Extensible, Scalable, and Maintainable Perl-Based Web Applications [2009] Writing Apache Modules with Perl and C [1999] Data Munging with Perl [2001] Perl and XML [2002] Perl Template Toolkit [2003] Pro Perl Parsing [2005] Practical Text Mining With Perl [2008] Programming for Linguists: Perl for Language Researchers [2003] An Introduction to Language Processing with Perl and Prolog [2010] request download ticket | Perl3.7z - ifile.it
-
Description: Script to create one sorted and unique wordlist from multiple wordlists. It takes as input N raw text files, a directory of them, or both. It parses the input and filters by string length on min and max specified. It will then sort all the data and make it unique for final output. L33t Speak is an option, see usage statement in prog. Features: L33t Speak Supports mix of standard text with L33t Speak Support for individual files, directory of files or both Filters output to size mandated by user Ensures uniqueness of output data Sorts output #!/usr/bin/perl # Script to create one sorted and unique wordlist from multiple wordlists. # It takes as input N raw text files, a directory of them, or both. # It parses the input and filters by string length on min and max specified. # It will then sort all the data and make it unique for final output. # L33t Speak is an option, see usage statement below. # # Author: Andres Andreu <andres [at] neurofuzz dot com> # File: generateDictionary.pl # Ver: 1.0 # Usage: perl generateDictionary.pl -file TEXT_FILE_1 -file TEXT_FILE_2 ... -file TEXT_FILE_N | -txtdir DIR_WHERE_FILES_ARE # -min MIN_WORD_LENGTH -max MAX_WORD_LENGTH -out OUTPUT_FILE # [-l33t [1 | 5 | 7 | 9]] [-mix 1] # use strict; use Getopt::Long; my ($min, $max, $fout, $txt_dir, $use_dir, $counter, $fcounter, $raw_dict, $key, $var, %count, $use_l33t, $l33t_val, $use_mix, $LEVEL); $counter = $fcounter = $use_mix = 0; my @rawfiles = (); $LEVEL = 5; Getopt::Long::Configure ("permute"); ############################################################################### # taken from Lingua::31337 by Casey West # C4S3y R. WES7 <C4SeY@g33KN3S7.c0m> my %CONVERSIONS = ( # handle the vowels 1 => { mixcase => 0, chars => { a => 4, e => 3, i => 1, o => 0, }, }, # Handle vowels and some consonants, # don't use punctuation in the translation, # shift case at random. 5 => { mixcase => 1, chars => { a => 4, e => 3, f => 'ph', i => 1, l => 1, o => 0, 's$' => 'z', t => 7, }, }, # Handle vowels and most consonants, # use punctuation in the translation, # shift case at random, # convert some letters. 7 => { mixcase => 1, chars => { a => 4, b => '|3', d => '|)', e => 3, f => 'ph', h => '|-|', i => 1, k => '|<', l => 1, 'm' => '|\/|', n => '|\|', o => 0, 's$' => 'z', t => '-|-', v => '\/', w => '\/\/', x => '><', }, }, # Handle vowels and most consonants, # use punctuation in the translation, # shift case at random, # convert some letters to others, # decide between several options. 9 => { mixcase => 1, chars => { a => [ 4, 'aw' ], b => '|3', ck => 'x', 'ck$' => 'x0rz', d => '|)', e => [ 3, 0, 'o' ], 'ed$' => 'z0r3d', 'er$' => '0r', f => 'ph', h => '|-|', i => 1, k => '|<', l => 1, 'm' => '|\/|', n => '|\|', o => 0, 's' => 'z', t => '-|-', v => '\/', w => '\/\/', x => '><', }, }, ); sub text231337 { my @text = @_; my @new_text = (); $LEVEL-- until exists $CONVERSIONS{$LEVEL}; foreach my $line ( @text ) { foreach ( keys %{$CONVERSIONS{$LEVEL}->{chars}} ) { if ( ref $CONVERSIONS{$LEVEL}->{chars}->{$_} ) { $line =~ s/($_)/(0,1)[rand 2] ? @{$CONVERSIONS{$LEVEL}->{chars}{$_}}[rand $#{$CONVERSIONS{$LEVEL}->{chars}{$_}}] : $1/egi; } else { $line =~ s/($_)/(0,1)[rand 2] ? $CONVERSIONS{$LEVEL}->{chars}{$_} : $1/egi; } } $line =~ s/([A-Z])/(0,1)[rand 2] ? uc($1) : lc($1)/egi if $CONVERSIONS{$LEVEL}->{mixcase}; push @new_text, $line; } return @new_text; } # End of module Lingua::31337 usage ############################################################################### sub usage(){ print "\nUsage: perl generateDictionary.pl -file TEXT_FILE_1 -file TEXT_FILE_2 ... -file TEXT_FILE_N | -txtdir DIR_WHERE_FILES_ARE " . "-min MIN_WORD_LENGTH -max MAX_WORD_LENGTH [-l33t [1 | 5 | 7 | 9]] [-mix 1] " . "-out OUTPUT_FILE\n\n" . "-min & -max establish the string length range you want your data filtered on\n" . "-out sets the resource for final data output\n" . "-file sets individual files to feed the final dictionary (enter as many as you like)" . "[-txtdir] the path to a directory where some source dictionary files exist\n" . "[-l33t] sets on the option to use L33t Speak translation, valid values are 1,5,7,9\n" . "[-mix] sets on the option to use both L33T Speak and clear text strings simultaneously\n" . "when the \"-mix\" switch is used, the \"-l33t\" switch MUST also be used\n\n"; exit(); } #Define initial hash my %opts=(); GetOptions(\%opts,"min=i", "max=i", "file=s" => \@rawfiles, "txtdir=s", "l33t=s", "mix=s", "out=s"); #Display Usage if no options were passed if(keys(%opts)==0) { usage(); } #Process the options if (defined($opts{min})) { $min = $opts{min}; } if (defined($opts{max})) { $max = $opts{max}; } if (defined($opts{file})) { push(@rawfiles, $opts{file}); } if (defined($opts{txtdir})) { $txt_dir = $opts{txtdir}; $use_dir = 1; } if (defined($opts{l33t})) { $l33t_val = $opts{l33t}; $use_l33t = 1; } if (defined($opts{mix})) { $use_mix = 1; } if (defined($opts{out})) { $fout = $opts{out}; } #Handle conditions if ((!$min) || (!$max) || (!$fout)) { usage(); } if ((!@rawfiles) && (!$txt_dir)) { usage(); } if (($use_mix) && (!$use_l33t)) { print "If you want to use the \"mix\" mode for both normal strings " . "and L33t Speak combined, then you must use the \"-l33t\" switch \n\n"; usage(); } if ($use_l33t) { if (($l33t_val != 1) && ($l33t_val != 5) && ($l33t_val != 7) && ($l33t_val != 9)) { print "The only acceptable values for the L33t Speak option are " . "1 | 5 | 7 | 9 \n\n"; usage(); } $LEVEL = $l33t_val; } open( FINALDICT, ">$fout") or die "Can't open output file $fout..."; # dir listing used if ($use_dir) { opendir(DIRTXT,$txt_dir) or die "Can't access " . $txt_dir . "\n"; foreach (readdir(DIRTXT)){ push(@rawfiles, $txt_dir . $_); } closedir (DIRTXT); } # iterate through each text file to be parsed # ignore this prog and hidden files via regex foreach $raw_dict (@rawfiles) { # no need to process these # regex out hidden files as such: /. if(($raw_dict eq ".") || ($raw_dict eq "..") || ($raw_dict =~ "generateDictionary.pl") || ($raw_dict =~ m/\/\./)) { next; } # strip start and end white space $raw_dict =~ s/^\s+//; $raw_dict =~ s/\s+$//; #increment file counter $fcounter++; open(RAWDICT,$raw_dict) or die "Can't open input file $raw_dict\n"; while ($var=<RAWDICT>) { $var =~ s/^\s+//; $var =~ s/\s+$//; if ((length($var) <= $max) && (length($var) >= $min)) { if($var) { if (($use_l33t) && ($use_mix)) { $count{join("",text231337($var))}++; $count{$var}++; } elsif (($use_l33t) && (!$use_mix)) { $count{join("",text231337($var))}++; } else { $count{$var}++; } } } } close (RAWDICT); } # perl hashes enforce uniqueness and sort for us foreach $key (sort keys %count) { print FINALDICT "$key\n"; $counter++; } print "\nYour sorted unique dictionary consists of data from " . $fcounter . " raw files, is located in file \"" . $fout . "\" and has " . $counter . " items in it ...\n\n"; close (FINALDICT); Mirror
-
- dictionary
- generate
-
(and 2 more)
Tagged with:
-
Author(s) Joe Stewart Latest Version 0.1 Description Foregone is a forensic file recovery tool written in Perl. It was inspired by the Air Force Office of Special Investigations' forensic tool known as "Foremost", which uses defined headers and footers of certain file types to search a raw disk image and extract files with those characteristics. Foregone is a Perl implementation of the same technique with some added features: Only searches for headers starting on a block boundary, for a speed increase Uses compression to reject interleaved blocks of dissimilar files Foregone should not be considered an investigative-level forensic tool, but merely a utility that may help you recover files from a corrupted filesystem. #!/usr/bin/perl use Compress::Zlib; ## foregone.pl - recover files of a given type from a raw disk image even if ## interleaved with other blocks (blocks must be in correct order) ## ## (c)2003-2006 Joe Stewart <jstewart@lurhq.com> ## ## Foregone is released under the GNU General Public License. ## examples ## ## PDF ## ## my $header = "\x25\x50\x44\x46\x2D"; ## my $footer = "\x25\x25\x45\x4F\x46"; ## my $extension = "pdf"; ## my $mustfind = ""; ## my $mustfind2 = ""; ## GNUCASH ## ## my $header = "<?xml version=\"1.0\"?>\n<gnc-"; ## my $footer = "<!-- End: -->"; ## my $extension = "xml"; ## my $mustfind = "<act"; ## my $mustfind2 = "<trn"; ## JPEG ## my $header = "\xff\xd8\xff\xe0"; my $footer = "\xff\xd9"; my $extension = "jpg"; my $mustfind = ""; my $mustfind2 = ""; ## Blocksize of filesystem being read ## my $blocksize = 1024; ## Threshold to reject blocks based on compressed size ## compares initial block size when compressed with subsequent block ## sizes when compressed ... good at rejecting dissimliar types of data ## More than this zthreshold percent deviation will result in rejection ## Adjust as needed depending on how many bad blocks you get in output my $zthreshold = 50; ## maximum size of any output file ## my $maxbytes = 3000000; ## directory to write recovered files. Will be created if it doesn't exist ## my $recoverdir = "foregone-recover"; my $image = $ARGV[0]; my $size = (stat($image))[7]; my $buf = ""; my $buflength = length($header); my $found = 0; my $outbytes = 0; my $pos = 0; die "Usage: $0 <disk image>\n" unless $image; open (IN, $image) or die "Could not open $image : $!\n"; unless (-e "$recoverdir") { mkdir("$recoverdir", 0755) or die "Could not create $recoverdir : $1\n"; } while ($pos < $size) { my $blockpos = $pos; read(IN,$buf,$buflength) or last; $percent = ($pos / $size) * 100; printf("Looking at first %s bytes of block at offset $pos (%.2f%% done)\r", $buflength, $percent); if ($buf eq $header) { print "\nHeader match at $pos\n"; print "Extracting file...\n"; &extract_file; } $pos += $blocksize; seek(IN,$pos, 0) or die "\ncould not seek to $pos"; } print "\nFinished.\n"; close IN; sub extract_file { $found++; my $filename = sprintf("recovered.%05d.%s", $found, $extension); open(OUT, ">$recoverdir/$filename") or die "Couldn't write output file!\n"; print OUT $buf; my $tmpblocksize = $blocksize - $buflength; while ($pos < $size) { read(IN,$block,$tmpblocksize) or last; $tmpblocksize = $blocksize; my $zblock = compress($block); my $zblocklength = length($zblock); if (!$zfirstblock) { $zfirstblock = $zblocklength; $lowerlimit = ((100 - $zthreshold) / 100) * $zfirstblock; $upperlimit = ((100 + $zthreshold) / 100) * $zfirstblock; } else { if ($block !~ /$footer/) { # compressed block size is too different. reject it. if ($zblocklength > $upperlimit || $zblocklength < $lowerlimit) { print "Rejected block: compressed size = $zblocklength : $lowerlimit < $zfirstblock > $upperlimit\n"; next; } } } if ($mustfind) { next unless $block =~ /$mustfind|$mustfind2/; } if ($block =~ /$footer/ || $outbytes + $blocksize > $maxbytes ) { my ($blockt, $garbage) = split(/$footer/, $block); print OUT $blockt . $footer; $outbytes += length($blockt) + length($footer); if (length($blockt) + length($footer) == $blocksize) { print "Failed to truncate last block\n" } last; } $outbytes += $blocksize; print OUT $block; } print "Wrote $recoverdir/$filename ($outbytes bytes)\n"; $outbytes = 0; close OUT; } Source