Skip to content

Commit 0319379

Browse files
committed
adds changes for py2.7->3
1 parent 20bfab9 commit 0319379

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ This is essentially in situations where ZeroConf may not be suitable. For system
99
- [nmap](https://nmap.org/)
1010
- [sshpass](http://sourceforge.net/projects/sshpass/)
1111

12+
## Installing Dependencies
13+
```
14+
$ sudo apt-get install nmap
15+
$ python3 -m pip install paramiko --user
16+
```
17+
Can ignore the install.sh script for now, please raise an issue for any concerns.
18+
1219
## Usage
1320
Clone the project in your directory. Ensure that the Python package dependencies are met.
1421

install.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#!/bin/bash
22

3-
sudo apt-get install -y python-pamariko nmap sshpass
3+
sudo apt-get install -y nmap
4+
python3 -m pip install paramiko

sherlock.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ def getInput(opts):
2222
ip = opts.ext
2323
win = opts.win
2424
# Get auth
25-
print "Welcome to Sherlock IP finder."
26-
username = raw_input("Username: ")
25+
print("Welcome to Sherlock IP finder.")
26+
username = input("Username: ")
2727
password = getpass.getpass()
2828
if not ip:
29-
idx= int(raw_input("Enter net interface: 1 - eth0, 2 - wlan0: "))
29+
idx= int(input("Enter net interface: 1 - eth0, 2 - wlan0: "))
3030
netif = ['eth0', 'wlan0']
3131
# Get the IP address
3232
f = os.popen('ifconfig '+ netif[idx-1] +' | grep "inet\ addr" | cut -d: -f2 | cut -d" " -f1')
@@ -57,14 +57,14 @@ def worker(host, username, password):
5757
try:
5858
ssh = paramiko.SSHClient()
5959
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
60-
print "Trying for " + host + " ...."
60+
print("Trying for " + host + " ....")
6161
ssh.connect(host, username = username, password = password)
62-
print "Connected for " + host
62+
print("Connected for " + host)
6363
found = host
6464
return True
6565
except (paramiko.ssh_exception.BadHostKeyException, paramiko.ssh_exception.AuthenticationException,
6666
paramiko.ssh_exception.SSHException, socket.error) as e:
67-
print e
67+
print(e)
6868
return False
6969

7070
def findMc(ip, username, password):
@@ -78,12 +78,12 @@ def findMc(ip, username, password):
7878
t.join()
7979

8080
if found is not None:
81-
print "The correct destination is " + found
81+
print("The correct destination is " + found)
8282

8383
if __name__ == '__main__':
8484
opts = parseCmd()
8585
[ip, username, password] = getInput(opts)
8686
hostname = findMc(ip, username, password)
8787
if opts.red:
88-
print "Redirecting you to the SSH connection"
88+
print("Redirecting you to the SSH connection")
8989
os.system('sshpass -p '+password+' ssh '+username+'@'+hostname)

0 commit comments

Comments
 (0)