Hi,
While we're still on the subject, the problem when executing the websploit's "wifi/wifi_dos" module is somehow related with the working directory. The websploit executable file located at /usr/bin/websploit when executed will prompt the users to the root directory i.e. /root, as the application's working directory.
# To check your current working directory. Execute "os pwd" in the Websploit Framework.
The Problem:
This poses a problem when using the "wifi/wifi_dos" module located at /usr/share/websploit/modules/wifi_dos.py, since the script itself are instructed to change its directory to 'temp' [line 76, os.chdir("temp") of wifi_dos.py] which neither wasn't in the /usr/share/websploit directory nor does it in our current directory i.e. /root, hence resulted the following errors when running the script:
Code:
Traceback (most recent call last):
File "/usr/bin/websploit", line 147, in <module>
start()
...
...
os.chdir("temp")
OSError: [Errno 2] No such file or directory: 'temp'
Suggested Solutions:
# There are several ways to resolve this issue. First, create 'temp' in /root directory
This will work just fine but there's a downside to this solution. Whenever the users update their Websploit Framework, it forces the update to fetch the new 'core', 'modules' and 'websploit' files to the current directory and thus making /root directory populated with these new files rather than patching it to the correct path i.e. /usr/share/websploit for 'core' & 'modulse', and /usr/bin/websploit for 'websploit'. Although this can be done manually e.g. copying and pasting the new files to the right path or patching it with any file comparison tools. This can be tricky for some and there's a risk of breaking the program if it's done incorrectly. FYI, the new update comes with 1 new additional module called bluetooth/bluetooth_pod which means there are total of 17 modules available as oppose to 16 modules for the current update.
# To fix the flaw mentioned in the first solution. Start simply by creating 'temp' in /usr/share/websploit directory;
Code:
mkdir /usr/share/websploit/temp
Then, initiate the framework at the target path i.e. /usr/share/websploit, the users can either navigate manually to the path every time the users want to execute the application or create a bash script for the following command:
Code:
cd /usr/share/ && websploit
# Alternatively, we can also make some modification to the executable 'websploit' file at /usr/bin/websploit. Before proceed, backup the file first. For example:
Code:
cp /usr/bin/websploit /usr/bin/websploit.backup
# To edit the 'websploit', use any of your preferred text editor. Open the file at /usr/bin/websploit and scroll to line 36, insert the following code, save and exit.
Code:
os.chdir("/usr/share/websploit/")
# Reference text to edit 'websploit'.
Code:
35 import sys
36 sys.path.append("/usr/share/websploit/")
37 os.chdir("/usr/share/websploit/") # Insert here
38 from time import sleep
If you follow the latter solution, try execute 'websploit' in root direcotry and then check the current working directory with "os pwd" inside the Websploit Framework. If done correctly, the command should return the targeted path that's "/usr/share/websploit". Update the framework by passing the "update" to get the latest patch.
Code:
__ __ _ _ _ _
\ \ / / | | | | (_) |
\ \ /\ / /__| |__ ___ _ __ | | ___ _| |_
\ \/ \/ / _ \ '_ \/ __| '_ \| |/ _ \| | __|
\ /\ / __/ |_) \__ \ |_) | | (_) | | |_
\/ \/ \___|_.__/|___/ .__/|_|\___/|_|\__|
| |
|_|
--=[WebSploit FrameWork
+---**---==[Version :2.0.3
+---**---==[Codename :CyberTron
+---**---==[Available Modules : 17
--=[Update Date : [r2.0.3-119 15.10.2012]
wsf > os pwd
/usr/share/websploit
wsf > os ls
core modules temp
Okay, now that we've solved the working directory problems. I will now proceed to discuss on a minor problem when running the "wifi/wifi_dos" module. The framework is build to provide an automated way of running certain tools and in our case, a tool called "mdk3". Running the module is pretty much straight-forward and since this is not in the "how-to-" thread I will assume you guys know your way to reproduce the following error.
Methodology:
In brief, we will run the wifi/wifi_dos module, then stop, and re-run it again.To reproduce this error assuming all the required options have been properly setup, perform the following:
# Before run, check the current working directory
Code:
wsf:Wifi_Dos > os pwd
/usr/share/websploit
# Run the module
Code:
wsf:Wifi_Dos > run[*]Monitor Mod .... Enabled.[*]BlackList File .... Created.[*]Deauthentication - Dissasocition Attack .... Started.[*]Authentication DOS Attack .... Started.[*]Wifi Jamming Attack .... Started.[*]WIFI DOS Attack Has Been Started ...
# While still running, check the current working directory
Code:
wsf:Wifi_Dos > os pwd
/usr/share/websploit/temp
# Stop the module & check the working directory
Code:
wsf:Wifi_Dos > stop
wsf:Wifi_Dos > os pwd
/usr/share/websploit/temp
Notice the problem here, the module stopped but it doesn't leave the assigned path ("/usr/share/websploit/temp") when we first run the module. If we proceed to re-run. This produces the same error as mentioned earlier in this post.
# Re-run the module will produce the following error.
Code:
wsf:Wifi_Dos > run[*]Monitor Mod .... Enabled.
Traceback (most recent call last):
...
...
OSError: [Errno 2] No such file or directory: 'temp'
Okay, to fix this problem. We will just have to make a minor change to the "wifi_dos.py" script located at /usr/share/websploit/modules/wifi_dos.py. As always before we proceed, make a backup copy first.
# Example:
Code:
cp /usr/share/websploit/modules/wifi_dos.py /usr/share/websploit/modules/wifi_dos.py.backup
# Then, edit the "wifi_dos.py" with your preferred text editor. Scroll down to line 99 and insert the following code without the comment. Refer the reference text.
Code:
os.chdir(os.pardir) # This method will change the current working directory back to the parent directory i.e. /usr/share/websploit/
# Reference text
Code:
96 elif com[0:4] =='stop':
97 subprocess.Popen("killall aireplay", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).wait()
98 subprocess.Popen("killall mdk3", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).wait()
99 subprocess.Popen("killall xterm", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).wait()
100 os.chdir(os.pardir)
101 wifi_dos()
Done with that, we can proceed to repeat the procedure earlier to test if its return error.
# Run websploit & check the working directory
Code:
wsf > os pwd
/usr/share/websploit
# Set the module and configure the required options and run the module
Code:
wsf:Wifi_Dos > run[*]Monitor Mod .... Enabled.[*]BlackList File .... Created.[*]Deauthentication - Dissasocition Attack .... Started.[*]Authentication DOS Attack .... Started.[*]Wifi Jamming Attack .... Started.[*]WIFI DOS Attack Has Been Started ...
# Check the working directory while the module is running
Code:
wsf:Wifi_Dos > os pwd
/usr/share/websploit/temp
# Stop the module and again check the working directory
Code:
wsf:Wifi_Dos > stop
wsf:Wifi_Dos > os pwd
/usr/share/websploit
# Since the module when prompted to stop & return to its parent directory. We now can run and re-run the module incessantly without error. :P
Code:
wsf:Wifi_Dos > run[*]Monitor Mod .... Enabled.[*]BlackList File .... Created.[*]Deauthentication - Dissasocition Attack .... Started.[*]Authentication DOS Attack .... Started.[*]Wifi Jamming Attack .... Started.[*]WIFI DOS Attack Has Been Started ...
wsf:Wifi_Dos > os pwd
/usr/share/websploit/temp
wsf:Wifi_Dos > stop
wsf:Wifi_Dos > os pwd
/usr/share/websploit
Last not least, all the mentioned above is just sorta "Suggested Solutions". You may want to proceed at your own risk. :P