Results 1 to 5 of 5
Hi all...so I'm making this script that will run through a file (each ssid on it's own list, with spaces in it) and running a program. Problem is, as I ...
- 11-03-2009 #1Just Joined!
- Join Date
- Nov 2009
- Posts
- 3
While-Read problem
Hi all...so I'm making this script that will run through a file (each ssid on it's own list, with spaces in it) and running a program. Problem is, as I tested with echo, anything I put after the $line is basically going to the beginning and overwriting. Here's my code:
If I placed an echo in front of genpmk to see what it's trying to do...while you can see here:Code:#!/bin/bash cat ssid-space | while read list do genpmk -f worldlist -d \"${list}\" -s \"${list}\" done
It is much appreciated.Code:" -s "Wireless Network "Wireless Network " -s "Philips WiFit -d "Philips WiFi " -s "Customer IDst -d "Customer ID " -s "Home Networkt -d "Home Network " -s "Harvard UniversityHarvard University " -s "My Wireless Network AWireless Network A " -s "Intel Gateway -d "Intel Gateway " -s "IU Wirelessst -d "IU Wireless " -s "Verizon Wi-Fi -d "Verizon Wi-Fi " -s "<any ssid>ist -d "<any ssid> " -s "home wireless -d "home wireless
- 11-03-2009 #2Linux User
- Join Date
- May 2008
- Location
- NYC, moved from KS & MO
- Posts
- 251
Can you show some sample of the file ssid-space? Also help us understand what exactly you are trying to achieve - what should a NORMAL/CORRECT line look like in the while loop?
- 11-03-2009 #3Just Joined!
- Join Date
- Nov 2009
- Posts
- 3
So sorry, should have thought about that in the beginning.
The ssid-space file contains:
The genpmk for the first genpmk command should therefore look like this:Code:Wireless Network Philips WiFi Customer ID Home Network Harvard University My Wireless Network A Intel Gateway IU Wireless Verizon Wi-Fi <any ssid> home wireless My Network
Thanks!Code:genpmk -f wordlist -d "Wireless Network.hash" -s "Wireless Network"
- 11-03-2009 #4Linux User
- Join Date
- May 2008
- Location
- NYC, moved from KS & MO
- Posts
- 251
It would be much easier with awk for this kind of task:
!/^$/ is used to prevent empty lines being printed (just in case you have empty lines in ssid-space. \42 is the double quotation mark.Code:awk '!/^$/{print "genpmk -f wordlist -d \42"$0".hash\42 -s \42"$0"\42"}' ssid-space|sh
- 11-10-2009 #5Just Joined!
- Join Date
- Nov 2009
- Posts
- 3
So, it turns out that the ssid file itself was the culprit. It was made in windows so it had the carriage return \r at the end of the lines. This was causing the issue. I'm not sure if my original code would have worked or not, but secondmouse's worked beautifully after I took out the carriage returns. Thank you so much for the help!


Reply With Quote
