-
January 22nd, 2006, 01:38 AM
#1
Junior Member
Hash file #Perl
Code:
#!perl
# hash.pl (written by n0m3rcy)
use strict;
use Digest::MD5;
use Digest::SHA1;
my $file = shift || die "Must enter a filename.\n";
if (-e $file) {
my ($md5,$sha) = hash($file);
print "File : ".$file."\n";
print "MD5 : ".$md5."\n";
print "SHA-1: ".$sha."\n";
}
else {
print "$file not found.\n";
}
#------------------------------------------
# hash subroutine
#------------------------------------------
sub hash {
my $file = $_[0];
my $md5;
my $sha;
eval {
# Generate MD5 hash
open(FILE, $file);
binmode(FILE);
$md5 = Digest::MD5->new->addfile(*FILE)->hexdigest;
close(FILE);
# Generate SHA-1 hash
open(FILE, $file);
binmode(FILE);
$sha = Digest::SHA1->new->addfile(*FILE)->hexdigest;
close(FILE);
};
($@) ? (return $@) : (return ($md5,$sha));
}
Regards,
n0m3rcy
n0m3rcy(); BEG me or DIE
contact: irc://irc.milw0rm.com #milw0rm
-
January 22nd, 2006, 05:15 AM
#2
This is neat and all, but your commenting needs something...
#------------------------------------------
# hash subroutine
#------------------------------------------
Kind of obvious isn't it?
But then it's also not your code... unless you are providing the examples to safari's informit book site.
http://safariexamples.informit.com/0...h5code/hash.pl
Your download/copy/paste skills are excellent! Well done!
"When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
"There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
"Mischief my ass, you are an unethical moron." - chsh
Blog of X
-
January 22nd, 2006, 05:25 AM
#3
Junior Member
hey, thanks for comment
this mine, i gave it for somebody, i didn't know if he changed it
really, it's mine
n0m3rcy(); BEG me or DIE
contact: irc://irc.milw0rm.com #milw0rm
-
January 22nd, 2006, 05:28 AM
#4
Really? You gave it to Harlan Carvey for use in his Windows Forensics and Incident Recovery book? And he's using the code with your claim to ownership stripped?
And monkeys will start flying out of my butt. Next time at least modify more code than adding your name to it before you try to pass it off as yours to look cool.
"When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
"There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
"Mischief my ass, you are an unethical moron." - chsh
Blog of X
-
January 22nd, 2006, 05:31 AM
#5
Junior Member
You'll see if it's mine or not, by my projects and codes soon
Regards,
n0m3rcy(); BEG me or DIE
contact: irc://irc.milw0rm.com #milw0rm
-
January 22nd, 2006, 05:34 AM
#6
Windows Forensics and Incident Recovery. Harlan Carvey. Listing 5-12. p. 229
Perl can be used to create scripts that compute MD5 and SHA-1 hashes for files. Hash.pl, the Perl script illustrated in Listing 5-12, is such a script.
Look at that... it says Copyright 2005 by Pearson Education, Inc. in my copy...
n0m3rcy > stop bullshitting Juridian... your only way out was claiming you're Carvey himself, but unfortunately for you, Carvey is not an idiot and knows how to spell...
-
January 22nd, 2006, 05:39 AM
#7
But, I'd still love to see more of your code. It should be loads of fun. =) I dabble in that software development stuff myself from time to time.
"When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
"There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
"Mischief my ass, you are an unethical moron." - chsh
Blog of X
-
January 22nd, 2006, 06:19 AM
#8
Originally posted here by n0m3rcy
You'll see if it's mine or not, by my projects and codes soon
Just a footnote: If it has been written, whether it is deals with the various programming languages, all aspects of security, etc., someone in here has probably already, read it, done a report on it, and referenced it. So don't try to pull the wool over someone's eyes. Tonight was a classic example, you hit the jackpot, two members even knew the exact code, and Neg even had the page and figure number. That's Carvey's work not yours.
When you code, just give credit where it is due!
cheers
Connection refused, try again later.
-
January 22nd, 2006, 12:10 PM
#9
Hey,n0m3rcy
As a matter of "style", just posting a block of code isn't that cool, some form of commentary would make it look a lot better............
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|