Skip to content

Commit 95abaaf

Browse files
committed
sum md5 hash
1 parent a1c95c3 commit 95abaaf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

md5_hash.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
4+
function hashsum {
5+
regex='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'
6+
if [[ $1 =~ $regex ]]; then
7+
echo -e "md5('$1'): \c"
8+
echo $(curl -s $1 | md5sum | cut -d ' ' -f1)
9+
fi
10+
11+
if [ -e $1 ]; then
12+
echo -e "md5('$1'): \c"
13+
echo $(md5sum $1 | cut -d ' ' -f1)
14+
fi
15+
}
16+
17+
hashsum "https://www.offensive-security.com/"
18+
hashsum "/etc/passwd"

0 commit comments

Comments
 (0)