how to fix this Separator unmatched and wordlist.txt: No such file or directory? - hashcat

MacBook:~ apple$ `hashcat -m 22000 capture.hccapx wordlist.txt`
hashcat (v6.2.5) starting
wordlist.txt: No such file or directory
Started: Thu *** ** 14:36:23 ****
Stopped: Thu ** ** 14:36:23 ****
MacBook:~ apple$ `hashcat -m 22000 -a3 capture.hccapx "?d?d?d?d?d?d?d?d`
hashcat (v6.2.5) starting
* Device #2: This device's local mem size is too small.
OpenCL API (OpenCL 1.2 (May 7 2020 00:10:14)) - Platform #1 [Apple]
====================================================================
* Device #1: Intel(R) Core(TM)2 Duo CPU P8600 # 2.40GHz, 2016/4096 MB (512 MB allocatable), 2MCU
* Device #2: GeForce 320M, skipped
Minimum password length supported by kernel: 8
Maximum password length supported by kernel: 63
Hashfile 'capture.hccapx' on line 1 (HCPX): Separator unmatched
Hashfile 'capture.hccapx' on line 2 (): Separator unmatched
Hashfile 'capture.hccapx' on line 3 (): Separator unmatched
Hashfile 'capture.hccapx' on line 4 (): Separator unmatched
Hashfile 'capture.hccapx' on line 5 (): Separator unmatched
Hashfile 'capture.hccapx' on line 6 (????l?"?:9M†N??~Ry): Separator unmatched
Hashfile 'capture.hccapx' on line 7 (): Separator unmatched
Hashfile 'capture.hccapx' on line 8 (????l?"?:9M†N??~R): Separator unmatched
Hashfile 'capture.hccapx' on line 9 (????l?"?:9M†N??~Ry): Separator unmatched
Hashfile 'capture.hccapx' on line 10 (): Separator unmatched
Hashfile 'capture.hccapx' on line 11 (????l?"?:9M†N??~R): Separator unmatched
Hashfile 'capture.hccapx' on line 12 (): Separator unmatched
Hashfile 'capture.hccapx' on line 13 (): Separator unmatched
Hashfile 'capture.hccapx' on line 14 (??my): Separator unmatched
Hashfile 'capture.hccapx' on line 15 (): Separator unmatched
Hashfile 'capture.hccapx' on line 16 (??m): Separator unmatched
Hashfile 'capture.hccapx' on line 17 (??my): Separator unmatched
Hashfile capture.hccapx on line 18 (): Separator unmatched
Hashfile capture.hccapx on line 19 (??m): Separator unmatched
No hashes loaded.
Started: Thu *** ** 14:36:39 ****
Stopped: Thu *** ** 14:36:40 ****
how to fix this Separator unmatched and wordlist.txt: No such file or directory?

For some reason, Hashcat has deprecated the original method "-m 2500" to crack wpa2 and suggested "-m 22000".
I've founded an solution by googling a little bit and in this Q&A https://github.com/risinek/esp32-wifi-penetration-tool/issues/14
they suggest to use "-m 2500" and add "--deprecated-check-disable" to work with.

Related

Running a SQL query through DB2 Command Line Processor and viewing the output result in notepad++

I am able to execute a select query through DB2 Command Line Processor and view the output result in notepad++.
C:\db2cmd>db2 "select * from employee fetch first 5 rows only" > output.txt
When I open output.txt in Notepad++ , then output display is as shown below, After each and every line, carriage return(CR) and Line Feed(LF) is occuring.
92881 0 13 1223
92886 0 17 1224
92890 0 20 1225
92892 0 21 1226
92896 0 24 1227
5 records.
Why the CR LF occurs while opening the output query result .txt in notepad++? How to remove the CR LF between each records. I am expecting the output as shown below,

Compare and Replace inline using Awk/Sed command

I have a file (fixed length) in which searching for consecutive 2 lines starting with number 30 and then comparing value in position 183-187 and if both matching printing the line number. I am able to achieve the desired results up to this stage. But I would like to replace the value present in the line number with empty spaces without tampering the fixed length.
awk '/^30*/a=substr($0,183,187);getline;b=substr($0,183,187); if(a==b) print NR}' file
Explanation of the command above:
line number start with 30*
assign value to a from position between 183 to 187
get next line
assign value to b from position between 183 to 187
compare a & b - if matches it proves the value between 183 to 187 in 2 consecutive lines which starts with 30.
print line number (this is the 2nd match line number)
Above command is working as expected and printing the line number.
Example Record (just for explanation purpose hence not used fixed length)
10 ABC
20 XXX
30 XYZ
30 XYZ
30 XYZ
30 XYZ
40 YYY
10 ABC
20 XXX
30 XYZ
30 XYZ
40 YYY
With above command I could able to get line number 3 and 4 but unable to replace the 4th line output with empty spaces (inline replace) so that fixed width will not get compromised
Expected Output
10 ABC
20 XXX
30 XYZ
30
30
30
40 YYY
10 ABC
20 XXX
30 XYZ
30
40 YYY
Length of all the above lines should be 255 chars - when replace happens it has to be inline without adding it as new spaces.
Any help will be highly appreciated. Thanks.
I would use GNU AWK and treat every character as field, consider following example, let file.txt content be
10 ABC
20 XXX
30 XYZ
30 XYZ
40 YYY
then
awk 'BEGIN{FPAT=".";OFS=""}prev~/^30*/{a=substr(prev,4,3);b=substr($0,4,3);if(a==b){$4=$5=$6=" "}}{print}{prev=$0}' file.txt
output
10 ABC
20 XXX
30 XYZ
30
40 YYY
Explanation: I elected to use storing whole line in variable called prev rather than using getline, thus I do {prev=$0} as last action. I set FPAT to . indicating that any single character should be treated as field and OFS (output field separator) to empty string so no unwanted character will be added during line preparing. If prev (previous line or empty string for first line) starts with 3 I get substring with characters 4,5,6 from previous line (prev) and store it in variable a and get substring with characters 4,5,6 from current line ($0) and store it in variable b, if a and b are equal I change 4th, 5th and 6th character to space each. No matter it was changed or not I print line. Disclaimer: this assume that you want to deal with at most 2 subsequent lines having equal substring. Note /^30*/ does not check if string starts with 30 but rather if it does start with 3 e.g. it will match 312, you should probably use /^30/ instead, I elected to use your pattern unchanged as you imply it does work as intended for your data.
(tested in gawk 4.2.1)
This might work for you (GNU sed):
sed -E '/^30/{N;s/^(.{182}(.{5}).*\n.{182})\2/\1 /}' file
Match on a line beginning 30 and append the following line.
Using pattern matching, if the 5 characters from 183-187 for both lines are the same, replace the second group of 5 characters with 5 spaces.
For multiple adjacent lines use:
sed -E '/^30/{:a;N;s/^(.{182}(.{5}).*\n.{182})\2/\1 /;ta}' file
Or alternative:
sed -E ':a;$!N;s/^(30.{180}(\S{5}).*\n.{182})\2/\1 /;ta;P;D' file
It sounds like this is what you want, using any awk in any shell on every Unix box:
$ awk -v tgt=30 -v beg=11 -v end=13 '
($1==tgt) && seen[$1]++ { $0=substr($0,1,beg-1) sprintf("%*s",end-beg,"") substr($0,end+1) }
1' file
10 ABC
20 XXX
30 XYZ
30
40 YYY
Just change -v beg=11 -v end=13 to beg=183 -v end=187 for your real data.
If you're ever again tempted to use getline make sure to read awk.freeshell.org/AllAboutGetline first as it's usually the wrong approach.

Hot to trim every nth line by a different value?

I would like to trim the last XY characters of every 4th line. The cut off should be the different between the character count from line 4 and 2, and line 8 and 6.
For example: line 4 (29 characters) - line 2 (20 characters) = 9. So the last 9 characters of line 4 should be removed.
Input:
#V300059044L3C001R0010004402
AAGTAGATATCATGGAGCCG
+
FFFGFGGFGFGFFGFFGFFGGGGGFFFGG
#V300059044L3C001R0010009240
AAAGGGAGGGAGAATAAT
+
GFFGFEGFGFGEFDFGGEFFGGEDEGEGF
Output:
#V300059044L3C001R0010004402
AAGTAGATATCATGGAGCCG
+
FFFGFGGFGFGFFGFFGFFG
#V300059044L3C001R0010009240
AAAGGGAGGGAGAATAAT
+
GFFGFEGFGFGEFDFGGE
Running
awk 'NR%4==0 {$0=substr($0,1,a)} NR%2==0 {a=length($0)} {print $0}' input.txt
on input.txt
yields
#V300059044L3C001R0010004402
AAGTAGATATCATGGAGCCG
+
FFFGFGGFGFGFFGFFGFFG
#V300059044L3C001R0010009240
AAAGGGAGGGAGAATAAT
+
GFFGFEGFGFGEFDFGGE

How to print certain lines from sections of a file separated by a blank line with sed

I have been trying to come up with a sed command that will pull certain lines from blocks of text separated by a blank line in a file. The blocks of text are as below.
# cat test_file.txt
line 1
line 2
line 3
line 4
line 5
line 1
line 2
line 3
line 4
line 5
line 1
line 2
line 3
line 4
line 5
I am trying to pull out line 2 an 4 from each block so the output will be like below.
line 2
line 4
line 2
line 4
line 2
line 4
I came up with a way to do it for the first block of text using sed:
# sed -n -e 2p -e 4p test_flie.txt
line 2
line 4
But haven't been able to find a way to get it to continue for each block of text till the end of the file. Any pointers would be greatly appreciated.
awks paragraph mode exists specifically to handle blank-line separated records/blocks of text like you're dealing with:
$ awk 'BEGIN{RS=""; ORS="\n\n"; FS=OFS="\n"} {print $2, $4}' file
line 2
line 4
line 2
line 4
line 2
line 4
Reference the POSIX standard:
If RS is null, then records are separated by sequences consisting of a <newline> plus one or more blank lines, leading or trailing blank lines shall not result in empty records at the beginning or end of the input
If you need to not have a blank line printed after the final record:
$ awk 'BEGIN{RS=""; FS=OFS="\n"} NR>1{print prev ORS} {prev=$2 OFS $4} END{print prev}' file
line 2
line 4
line 2
line 4
line 2
line 4
or if you don't want to use paragraph mode for some reason then:
$ awk 'BEGIN{tgts[2]; tgts[4]} !NF{print ""; lineNr=0; next} ++lineNr in tgts' file
line 2
line 4
line 2
line 4
line 2
line 4
I'd use awk for this, e.g:
awk '(!NF&&m=NR)||NR-m==2||NR-m==4' file
This might work for you (GNU sed):
sed -n '/\S/{n;p;n;n;p;:a;n;//ba;p}' file
Set the -n option for explicit printing. Print the second and fourth lines then throw away any non-blank lines and print the first blank one. Repeat.

Different result when count line number of a file, using wc -l and cat -n

I heard that wc -l could count the number of lines in a file. However, when I use it to count lines of a file that was generated by Python, it gives a different result, miscounting one line.
Here is the MWE.
#!/usr/bin/env python
import random
def getRandomLines(in_str, num):
res = list()
lstr = len(in_str)
for i in range(num):
res.append(''.join(random.sample(in_str, lstr)))
return res
def writeRandomLines(rd_lines, fname):
lines = '\n'.join(rd_liens)
with open(fname, 'w') as fout:
fout.write(lines)
if __name__ == '__main__':
writeRandomLines(getRandomLines("foobarbazqux", 20), "example.txt")
This gives a file, example.txt, that contains 20 lines of random strings. And thus, the expection of the number of lines in example.txt is 20. However, when one applies wc -l to it, it gives 19 as the result.
$ wc -l example.txt
19 example.txt
When one uses cat -n to show the content of the file, with line number, one can see
$ cat -n example.txt
1 oaxruzaqobfb
2 ozbarboaufqx
3 fbzarbuoxoaq
4 obqfarbozaxu
5 xoqbrauboazf
6 ufqooxrababz
7 rqoxafuzboab
8 bfuaqoxaorbz
9 baxroazfouqb
10 rqzafoobxaub
11 xqaoabbufzor
12 aobxbaoruzfq
13 buozaqbrafxo
14 aobzoubfarxq
15 aquofrboazbx
16 uaoqrfobbaxz
17 bxqubarfoazo
18 aaxruzofbboq
19 xuaoarzoqfbb
20 bqouzxraobfa
Why wc -l miscount one line, and what could I do to fix this problem?
Any clues or hints will be appreciated.
In your python code, you have:
lines = '\n'.join(rd_liens)
So what you are really writing is :
word1\nword2\n...wordX-1\nwordX
Unfortunately, in man wc:
-l, --lines
print the newline counts
hence your difference.
Apparently wc -l needs to see a \n at the end of the line to count it as one. Your current format has the last line without a trailing \n, therefore not counted by wc -l. Add the newline and it should be fixed.
wc -l only counts number of new line characters.
Since you are appending lines with a '\n' characters, to join 20 lines only 19 '\n' characters were used. Hence result as 19.
If you need correct count, terminate each line with '\n'