How to display WEP key from pcap file in Wireshark - wireshark

I am following the following post to display the WEP key using Wireshark 3.0.1 on Windows
Multiple WEP keys which can be retrieved from the Pcap file
However, I am not able to see the WEP key although I see WEP related parameters like IV and ICV
https://imgur.com/KdnVmXG
How can I get the WEP key of the Wireless Access Point?
I also tried tshark on the command line with the following command
tshark -R wlan.wep.key -2 -Tfields -eframe.number -r file.pcap
But I get the following (showing last few lines of the output of the above command but all look like this)
19401 0
19402 0
19403 0
19404 0
19405 0
19406 0
19407 0
19408 0
19409 0
19410 0

Actually it turns out the you can use aircrack-ng to do this. Here is the command that I ran to extract the WEP key from pcap file. The command can be run on Kali Linux or Ubuntu
aircrack-ng -z filename.pcap
Here is the output of the above command
Aircrack-ng 1.1
[00:00:09] Tested 4138 keys (got 15273 IVs)
KB depth byte(vote)
0 1/ 5 6B(21760) 0B(19968) CF(19968) B5(19712) 98(19200) E8(19200) 37(18688)
1 0/ 2 F7(23808) 17(21760) 19(20224) 10(19968) BB(19968) 9F(19712) 68(19456)
2 1/ 7 F7(21760) 60(20992) 1B(20480) 0E(20224) 98(20224) 61(19456) 6E(18944)
3 6/ 14 3F(19456) E8(19456) C3(19200) E6(19200) 1A(19200) 8C(18944) B2(18944)
4 3/ 5 67(20224) 94(19968) BE(19456) C2(19456) 2A(19200) 8D(19200) 6F(18944)
KEY FOUND! [ AA:BB:CC:DD:EE ]
Decrypted correctly: 100%

Related

createsample.exe crashes every time

Hi I am trying to create samples using opencv_createsamples.exe but it crashes every time. I've checked different builds, opencv2 and opencv3. I don't know how to overcome this. My command looks like this
opencv_createsamples.exe -img C:/Users/dpach/Pictures/Interfejsy/img/1.jpg -maxxangle 15 -maxyangle 15 -maxzangle 1 -w 80 -h 40 -vec test.vec -bgtresh 0 -bgcolor 0 -show
The windows to show samples is opening but after that I receive info that program is not responding. Any ideas ?
// EDIT
I've tried to start it from a pseudo unix bash and I receive then Segmentation fault
// EDIT2
It crush after that Create training samples from single image applying distortions...

Error installing RVM: requiring BASH 3.2.25 (you have 4.3.42(4)-release)

I'm attempting to install RVM, and I have a more recent version of BASH. I assume that it needs a version that is 3.2.25 or more recent. I've seen a few post online about it, but they've all been dated or no longer relevant to the current code. Here is what I put in cmd (I have Windows 10 pro).
curl -L https://get.rvm.io | bash -s stable --autolibs=enabled --ruby --rails
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 184 100 184 0 0 143 0 0:00:01 0:00:01 --:--:-- 155
100 22865 100 22865 0 0 9566 0 0:00:02 0:00:02 --:--:-- 45730
Input file specified two times.
BASH 3.2.25 required (you have 4.3.42(4)-release)
The error "Input file specified two times," displayed when the check was run, is output from the Windows sort command. If you run this command it will show you which instance of the sort command is being run:
which sort
To ensure the correct version is always used, alter your PATH to include the typical Bash executable paths (/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin) before any Windows ones. Or, simply remove the Windows paths from your PATH.
Where you change this depends on how you've installed Bash (Cygwin, git-bash, etc.) but is typically a file in your home directory called .profile or .bash_profile.
My problem is ~/.bash_profile,
Because your head is wrong.
If you are using:
export PATH=some/other/path:${PATH}
Let's change to:
export PATH=${PATH}:some/other/path
Hope this help!

how to use svm-scale in LIBSVM?

I tried running the command svm-scale -l 0 -u 1 -s range data.data > data_scaled.data but I get the error: SyntaxError: invalid syntax. Please find details in the picture below.
I am running the command in a Windows command shell using a Python interface. Is my command format wrong?
I assume, that you use the original LIBSVM (as mentioned in the title of your question) package from here.
There the call should be svm-scale -l 0 -u 1 -s scaledParameters.txt input.data
According to the code, it will print the scaled output to your terminal. The -s option will write down the ranges of your feature values, e.g.
x
0 1
1 63375 13454352
2 1 10
3 1 10
4 1 10
5 1 10
6 1 10
7 1 10
8 1 10
9 1 10
10 1 10
If you just want to scale your data, you have to adapt the LIBSVM scale code to write the scaled data into a file.

php popen(exim) from a webpage

Problem: Apache accessing programs in /usr/bin
Platform:
Win/7 Pro Sp1
Apache 2.4
Php 5.6
Cygwin emulator gives Linux/Unix emu and has
Exim 4.84-1
program: sendit.php
hndl popen( exim ... )
fwrite(hndle, email_headers);
fwrite(hndle, email_body);
fflush(hndle);
fclose(hndle);
(a)launch from user account
php sendit.php -> exim/exim_main.log updated
reports 368 bytes sent to exim
-> email arrives
demonstrates sendit.php works & Exim config and permissions are correct
(b)launch from apache account uid(apache) gid(srvc)
php sendit.php -> exim/exim_main.log updated
reports 368 bytes sent to exim
-> email arrives
demonstrates sendit.php runs from any account
(c)launch from within a web page
Apache is run from its own uid/gid as in (b)
page.phtml sendit.php
-> NO update to exim log
-> no mail recv'd
reports same NNN bytes send to exim
NO I/O errors
I fwriting_stream 368 bytes ...
* wrote body fragment 368
* wrote total 368
I Wrote Body:(368) of 368
I Wrote EOT(5) of 5
I FLUSHING pipe
I closing pipe
I is closed pipe
I returning 3
adding -d+deliver+host_lookup+lookup+rewrite options to the popen(), yields nice trace - -
EXCEPT when run withing Apache - - nothing shows up
Apache cfg has ExecCGI in the directory and other php / perl programs run there.
Issue is Exim is not within the Apache environment (/usr/bin/exim)
So, created link /usr/bin/exim -> docroot/exim
and reference this instance popen(docroot/exim ...)
Still fails to deliver via pipe -> exim
Any ideas???
btw: have used popen in webpages several places with success
and yes, I verifed the popen return
$PIPE = popen( ... ...);if ($PIPE === false) die("*FE*);
STATUS: SOLVED 2015-05-30
Issue is Windows + Cygwin pathing
PHP tolerates Cygwin as $PATH is available.
Running within
Apache LoadModule php5_module "c:/php/php5.6/php5apache2_4.dll" does not
Must use an absolute WINDOWS path like
c:/cygwin/bin/exim-4.84-1.exe within the server.
php cmdPath_Tests.php
uses file_exists($path) exec to
find that path usable within Apache
Jeff#JeffPC7%
case 0 0 trying:
$ ls -l /usr/bin/exim
lrwxrwxrwx 1 Administrator None 24 Apr 6 09:19 /usr/bin/exim -> /usr/bin/exim-4.84-1.exe
Jeff#JeffPC7%
$ ls -l /usr/bin/exim /cygwin/bin/exim{,-4.84-1}.exe c:/cygwin/bin/exim-4.84-1.exe
case 1 1
ls: cannot access /cygwin/bin/exim.exe: No such file or directory
ls: cannot access /cygwin/bin/exim-4.84-1.exe: No such file or directory
lrwxrwxrwx 1 Administrator None 24 Apr 6 09:19 /usr/bin/exim -> /usr/bin/exim-4.84-1.exe
case 3 1 trying:
-rwxr-xr-x 3 Jeff None 1192467 Jan 25 19:16 c:/cygwin/bin/exim-4.84-1.exe
/usr/bin/exim
0 0 /usr/bin/exim
/usr/bin/exim-4.84-1.exe
0 1 /usr/bin/exim-4.84-1.exe
which: no exim-4.84-1.exe in (/cygwin/bin)
1 1 File Exists
cmd 1 1 trying: /cygwin/bin/exim-4.84-1.exe
results:
/usr/bin/exim-4.84-1.exe
2 1 trying: /usr/bin/exim-4.84-1.exe
I found:
3 1 trying: c:/cygwin/bin/exim-4.84-1.exe
cmd results:
2015-05-30 11:58:24 NP6FDA-000530-QD Completed
ie: email sent

opencv createsamples has no error, but no samples found

I'm using this tutorial, and I'm on the stage of creating lots of samples from my positive images. I'm using Windows.
This is the command:
perl bin/createsamples.pl positives.txt negatives.txt samples 1500\ "C:\opencv_built\bin\Release\opencv_createsamples.exe -bgcolor 0 -bgthresh 0 -maxxangle 1.1\ -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 80 -h 40"
And this is what I get as output, for each of the positive images:
C:\opencv_built\bin\Release\opencv_createsamples.exe -bgcolor 0 -bgthresh 0 -max
xangle 1.1\ -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 80 -h 40 -img 60inclin
ation_315azimuth.jpg -bg tmp -vec samples0inclination_315azimuth.jpg.vec -num 62
Info file name: (NULL)
Img file name: 60inclination_315azimuth.jpg
Vec file name: samples0inclination_315azimuth.jpg.vec
BG file name: tmp
Num: 62
BG color: 0
BG threshold: 0
Invert: FALSE
Max intensity deviation: 40
Max x angle: 1.1
Max y angle: 1.1
Max z angle: 0.5
Show samples: FALSE
Width: 80
Height: 40
Create training samples from single image applying distortions...
Done
The messages seemed successful so I went into the samples folder expecting to see 1500 samples, but there's nothing there! I noticed the info file is <NULL>, does that have anything to do with this? There doesn't seem to be any error, what went wrong?
Edit
I've changed the command to include absolute paths for everything, eg
perl bin/createsamples.pl C:\my_work\code\opencv-haar-classifier-training-master\positive_images\ C:\my_work\code\opencv-haar-classifier-training-master\positive_images\ samples 1500\ "C:\opencv_built\bin\Release\opencv_createsamples.exe -bgcolor 0 -bgthresh 0 -maxxangle 1.1\ -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 80 -h 40"
But still no luck!
I had a similar problem I'll try to explain what I did, I hope it will solve you problem.
First of all the NULL after -info is normal. As said in the official documentation of OpenCV for opencv_createcamples you need to either input an image (-img) or a collection of images (-info) I'll let you read the documentation for further understanding, but for this example you don't need it.
Secondly you don't need to put absolute paths in this command; here is my command:
perl bin/createsamples.pl positives.txt negatives.txt samples 1500 "opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -maxidev 40 -w 42 -h 40"
to do this be sure to be at the root of the gitHub directory you have download (the parent one of bin) be sure that your positives.txt and negatives. txt are in this directory. Also copy paste the opencv_createsamples.exe from OpenCV directory in this one.
This done I'll now explain the main problems: The project was developped for Ubuntu at the beginning so it works for mac easily but I think you must be under Windows. If you hadn't already please download Cygwin because it uses mainly Linux commands.
As I said I was blocked with a similar problem, so I tried to use opencv_createsample directly instead of the perl script to see if the problem was coming from there and I noticed that the problem was coming from the fact that my positives.txt and negatives.txt were under Windows format and not Unix so the Perl script wasn't able to read them properly.
The difference between windows and linux are big and Cygwin doesn't bridge the gap so there might be other encoding problems. So what I did is surely not the fastest way to resolve the problem, but it is an easy one.
I just installed an Ubuntu vm on my PC
Installed Opencv with TBB ( a lot of tutorials internet, the best is the one from the OpenCV site).
I Downloaded the gitHub Classifier training and then I followed the commands given and it worked well.
Another simpler explanation. Let's say you are new to OpenCV (as I am), and you're just following one of the tutorial videos, to create your first object detector. You might have created a sample image by cut-pasting from the web. Sample images must be monochrome, but more than that, they must be single-channel, 8-bit monochrome. If you photoshopped your sample to appear monochrome, but didn't change its channel configuration, opencv_createsamples will ignore it if it actually has more than one channel.
Source: ~/apps/createsamples/utilities.cpp, function icvStartSampleDistortion().
I was presented with a similar problem, also in Windows, but my solution was to check positives.txt and negatives.txt were in a format the the createsamples.pl file could understand. I'm not sure this was the same as your problem, but I ended up here so others might too.
I ran the following python script from the same directory as createsamples.pl to form the text files, which seemed to make the perl file work for me:
'''
Run this from the folder containing the positive and negative samples' folders (Note: outputs the text files to this directory)
'''
import glob
import sys
def write_locations(folder, textFile):
print('')
file = open(textFile, 'w')
for contents in glob.glob('{}/*'.format(folder)):
try:
fileName = contents.split("\\")[-1]
file.write('\n./{0}/{1}'.format(folder, fileName))
print('./{0}/{1}'.format(folder, fileName))
except:
pass
write_locations('positive', 'positives.txt')
write_locations('negative', 'negatives.txt')
print('\n -Done.')
The organisation of my folders might be slightly different to the tutorial (I only went there for the perl file), but all I'm doing is checking that the text files read something like:
./positive/1_1.png
./positive/1_2.png
./positive/1_3.png
./positive/1_4.png
and so on.
I had a similar problem I'll try to explain what I did, I hope it will solve your problem.
First, name the files positives.dat and negatives.dat instead of positives.txt and negatives.txt.
Second, copy and paste positives.dat and negatives.dat files into the current directory, then run:
perl bin/createsamples.pl positives.dat negatives.dat samples 1000 "opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 80 -h 40"
After that, check your samples folder, and you should see the positive & negative folders containing many vector files.
I had the same problem. The problem was that I had Captital letters in the filename, but not in the terminal code.
This should work:
perl bin/createsamples.pl positives.txt negatives.txt samples 3000 "opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 0 -maxyangle 0 maxzangle 0 -maxidev 40 -w 32 -h 32"

Resources