Skip to content

scan exit unexpectly and no target show user#88

Closed
tohug wants to merge 1 commit intoderv82:masterfrom
tohug:master
Closed

scan exit unexpectly and no target show user#88
tohug wants to merge 1 commit intoderv82:masterfrom
tohug:master

Conversation

@tohug
Copy link
Copy Markdown

@tohug tohug commented May 26, 2018

when i use the wifite 2.1.0 . I hava found it's exit unexpectly after catch package started some seconds . after take some time i have found when essid in .cvs file include some unicode char it will happen so i search a cure to make it goes well. i have test the cure it's work.
trace bug like this
File "/usr/share/wifite/wifite/tools/airodump.py", line 146, in get_targets
targets = Airodump.get_targets_from_csv(csv_filename)
File "/usr/share/wifite/wifite/tools/airodump.py", line 205, in get_targets_from_csv
for row in csv_reader:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 137-140: ordinal not in range(128)

when i use the wifite 2.1.0 . I hava found it's exit unexpectly after catch package started some seconds . after take some time i have found when essid  in .cvs file include some unicode char it will happen so i  search a cure to make it goes well. i have test the cure it's work.
trace bug like this 
  File "/usr/share/wifite/wifite/tools/airodump.py", line 146, in get_targets
    targets = Airodump.get_targets_from_csv(csv_filename)
  File "/usr/share/wifite/wifite/tools/airodump.py", line 205, in get_targets_from_csv
    for row in csv_reader:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 137-140: ordinal not in range(128)
@kimocoder
Copy link
Copy Markdown
Contributor

Remember that the latest version is actually v2.1.4 if you clone from the repo. Try cloning from repo to see if the problem is persistent before pushing changes based on the v2.1.0

@tohug
Copy link
Copy Markdown
Author

tohug commented May 26, 2018

sorry i don't know where is the newest code but i have download code from github it's version 2.1.4The problem still exists.Of course, this is indeed my fault. I did not check the latest version in advance.

@kimocoder
Copy link
Copy Markdown
Contributor

The newest code is here. Get the v2.1.4 with "git clone https://github.com/derv82/wifite2" and build/install it

@derv82
Copy link
Copy Markdown
Owner

derv82 commented May 27, 2018

Using sys.setdefaultencoding is discouraged (stackoverflow).

The bug is likely due to some non-ascii characters in the Airodump CSV output.

Wifite already decodes the output to UTF-8:

if type(line) is bytes: line = line.decode('utf-8')

So I'm not sure why/how this is happening.

Can you provide the .csv output from airodump?

Just run airodump-ng -w save which should create save-01.csv...

@tohug
Copy link
Copy Markdown
Author

tohug commented Jun 4, 2018

Hello, recently because of other things rarely on-line, I think cause bug is because
1, SSID contains non-ascii char. You can try directly to change your test WiFi SSID to Chinese.
2, I used it on Kali, and it's default Python running environment seems to be 2.7.

In fact, I'm not very familiar with Python, but often use the tool you developed. This solution is also get from online search. It may not be recommended. You can change it according to the situation.

@ChunshengZhao
Copy link
Copy Markdown
Contributor

@derv82 I submitted some code, and now the program already supports UTF-8 SSID. The attachment is a sample and I hope to help you.
aircrack-ng/aircrack-ng@b1d92cd
test-01.zip

Comment thread wifite/wifite.py
import os
import sys

reload(sys)
Copy link
Copy Markdown
Contributor

@ChunshengZhao ChunshengZhao Jun 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+if sys.version_info.major == 2:
+    reload(sys)
+    sys.setdefaultencoding('utf-8')
+

This exception only happens in python2, python3 is all right, but this patch code is not compatible with python3, so checking the version I think is better.

@ChunshengZhao
Copy link
Copy Markdown
Contributor

I studied it and found that this method is simpler, the patch is compatible with py2/3 :

kali-2018-06-09-17-16-27

diff --git a/wifite/tools/airodump.py b/wifite/tools/airodump.py
index e00acbc..ebd33a9 100755
--- a/wifite/tools/airodump.py
+++ b/wifite/tools/airodump.py
@@ -192,10 +192,9 @@ class Airodump(Dependency):
         '''Returns list of Target objects parsed from CSV file.'''
         targets = []
         import csv
-        with open(csv_filename, 'rb') as csvopen:
+        with open(csv_filename, 'r') as csvopen:
             lines = []
             for line in csvopen:
-                if type(line) is bytes: line = line.decode('utf-8')
                 line = line.replace('\0', '')
                 lines.append(line)
             csv_reader = csv.reader(lines,

@derv82
Copy link
Copy Markdown
Owner

derv82 commented Jun 10, 2018

I studied it and found that this method is simpler, the patch is compatible with py2/3 :

Thanks for finding that out. I'll work on integrating the change -- probably won't be using the Pull Request though.

@derv82 derv82 closed this in 1edba23 Jun 10, 2018
@derv82
Copy link
Copy Markdown
Owner

derv82 commented Jun 10, 2018

Change is in 2.1.6 (also marked as release).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants