I'm trying to crack a SHA-512 hash file. The format of the message is Format - $6$Salt$Password.
I'm using Hashcat for the same.
I'm getting the error : Separator Unmatched.
Below is my command :
Hashcat -a 0 -m 1720 filename.txt /usr/share/wordlists/rockyou.txt
I'm getting the error :
Hashfile on line1 ( content ) : Separator unmatched.
Please help.
The format for -m 1720 is 976b451818634a1e2acba682da3fd6efa72adf8a7a08d7939550c244b237c72c7d42367544e826c0c83fe5c02f97c0373b6b1386cc794bf0d21d2df01bb9c08a:2613516180127 as shown here
You probably want to use -m 1800.
Related
I'm trying to extract from a tab delimited file a number that i need to store in a variable. I'm approaching the problem with a regex that thanks to some research online I have been able to built.
The file is composed as follow:
0 0 2500 5000
1 5000 7500 10000
2 10000 12500 15000
3 15000 17500 20000
4 20000 22500 25000
5 25000 27500 30000
I need to extract the number in the second column given a number of the first one. I wrote and tested online the regex:
(?<=5\t).*?(?=\t)
I need the 25000 from the sixth line.
I started working with sed but as you already know, it doesn't like lookbehind and lookahead pattern even with the -E option to enable extended version of regular expressions. I tried also with awk and grep and failed for similar reasons.
Going further I found that perl could be the right command but I'm not able to make it work properly. I'm trying with the command
perl -pe '/(?<=5\t).*?(?=\t)/' | INFO.out
but I admit my poor knowledge and I'm a bit lost.
The next step would be to read the "5" in the regex from a variable so if you already know problems that could rise, please let me know.
No need for lookbehinds -- split each line on space and check whether the first field is 5.
In Perl there is a command-line option convenient for this, -a, with which each line gets split for us and we get #F array with fields
perl -lanE'say $F[1] if $F[0] == 5' data.txt
Note that this tests for 5 numerically (==)
grep supports -P for perl regex, and -o for only-matching, so this works with a lookbehind:
grep -Po '(?<=5\t)\d+' file
That can use a shell variable pretty easily:
VAR=5 && grep -Po "(?<=$VAR\t)\d+"
Or perl -n, to show using s///e to match and print capture group:
perl -lne 's/^5\t(\d+)/print $1/e' file
Why do you need to use a regex? If all you are doing is finding lines starting with a 5 and getting the second column you could use sed and cut, e.g.:
<infile sed -n '/^5\t/p' | cut -f2
Output:
25000
One option is to use sed, match 5 at the start of the string and after the tab capture the digits in a group
sed -En 's/^5\t([[:digit:]]+)\t.*/\1/p' file > INFO.out
The file INFO.out contains:
25000
Using sed
$ var1=$(sed -n 's/^5[^0-9]*\([^ ]*\).*/\1/p' input_file)
$ echo "$var1"
25000
To set the file modification date of images to the exif date, I tried the following:
exiftool '-FileModifyDate<DateTimeOriginal' image.jpg
But this gives me an error about SetFileTime.
So maybe exiftool cannot do it in linux.
Can I combine
exiftool -m -p '$FileName - $DateTimeOriginal' -if '$DateTimeOriginal' -DateTimeOriginal -s -S -ext jpg . with "touch --date ..."?
See this Exiftool Forum post.
The command used there is (take note of the use of backticks, not single quotes):
touch -t `exiftool -s -s -s -d "%Y%m%d%H%M.%S" -DateTimeOriginal TEST.JPG` TEST.JPG
But I'm curious about your error. Exiftool should be able to set the FileModifyDate on Linux (though FileCreateDate is a different story). What version of Exiftool are you using (exiftool -ver to check)?
Another possibility is that the DateTimeOriginal tag is malformed or doesn't have the full date/time info in it.
FWIW, StarGeek's answer was a great pointer in the right direction, but it did not work for me: many of my photos were reported to have "Invalid EXIF text encoding" (no obvious difference compared to those that were "fine"), even though exiftool somefile.jpg would clearly output a valid "Modify Date".
So this is what I did:
for i in *.jpg ; do d=`exiftool $i | grep Modify | sed 's/.*: //g'` ; echo "$i : $d" ; done
...to produce output like this:
CAM00786.jpg : 2013:11:19 18:47:27
CAM00787.jpg : 2013:11:25 08:46:08
CAM00788.jpg : 2013:11:25 08:46:19
...
It was enough for me to output the timestamps next to the file names, but given a little bit of date-time formatting, it could easily be used to "touch" the files to modify their filesystem timestamps.
I need to print only the sections I want from a string. For example:
10/11/12 05:34:34 Writer has an issue. Check this info [Avg. 12 write issues found]
I want to match "10/11/12 05:34:34 Writer" and "[Avg. 12 write issues found]"
Writer sometimes can be Reader, so I need to consider that also. Regexp are ovbiously required, but nothing I have tried with sed gets me both sections of the string. BTW, I use solaris 10 so the sed version there does not support the -r parameter :(
I currently process the string twice and put the result in a variable so I can print both variables at the end. However, I want to do this in a single line of code
How can I print two sections I need from a string?
Thank you
Try doing this :
sed -r 's/^(.*(Reader|Writer)).*(\[.*\])/\1 \3/' file
Finally :
$ oIFS="$IFS"
$ IFS=$'\n'; arr=( $(sed -r 's/^(.*(Reader|Writer)).*(\[.*\])/\1\n\3/' file) )
$ IFS="$oIFS"
$ echo "${arr[0]}"
10/11/12 05:34:34 Writer
$ echo "${arr[1]}"
[Avg. 12 write issues found]
edit
without -r :
sed 's/^\(.*\(Reader\|Writer\)\).*\(\[.*\]\)/\1\n\3/' file
You can find the two pattern and print them together without using -r value as follows
sed 's#\([0-9]\{2\}.*:[0-9]\{2\} \S*\).*\(\[.*\]\)#\1 \2#g'
Results
10/11/12 05:34:34 Writer [Avg. 12 write issues found]
Matching Writer or Reader without using -r option with sed
sed -e 's#\([0-9]\{2\}.*:[0-9]\{2\} Writer\).*\(\[.*\]\)#\1 \2#g' -e 's#\([0-9]\{2\}.*:[0-9]\{2\} Reader\).*\(\[.*\]\)#\1 \2#g' my_file
I'm having a small issue, i'm running and cron task every 5 minutes which is looking text chain and replacing it with nothing..
In order to optmize something i would like to add a new function to my cronstrask : send me an email if it replaces something.. if the crontask does not find the chain no need to send a mail. I have no idea how to do that , maybe you can help me .
Here is my current cron task :
find /home -type f | xargs sed -i 's$chain if would like to era$ $g'
Thanks in advance
Here is an example that I did with help of other poeple.
It will maybe help some other poeple
#!/bin/bash
grep -r -q 'stringtoreplace' /home/ #Find the string in all files on my home
if [ $? == 0 ] #if the last result fit then
then
echo "At the following time : " $(date +%H:%M:%S) | mail -s "[Serveur Leaked] Bad iframe has been found " my#mail #we send a mail with the date
find /home -type f | xargs sed -i 's$stringtoreplace$ $g' #we replace the string with a whitespace
else
exit 1
fi
exit 0
I found this command on SO which is exactly what I wanted to know but I only see the console output. I need the command to re-write the file it's working on (file.txt). This command takes every number (well, positive integer) in a file that is greater than 400 and add 13 to it.
perl -pe 's/\d+/$& > 400 ? $&+13 : $&/ge' file.txt
Add the option -i for in-place editing:
perl -i -pe 's/\d+/$& > 400 ? $&+13 : $&/ge' file.txt