Jump to content
Usr6

Putty auto-login

Recommended Posts

Posted (edited)

Scriptul de mai jos automatizeaza putty-ul a.i. sa schimbe ip-ul la un interval de timp stabilit de utilizator. Creaza un tunel ssh cu unu din conturile gasite in fisierul nologine.txt, contul la care se conecteaza este ales in mod aleator, cand expira timpul stabilit se creaza un nou tunel folosind alt cont ales aleator si tot asa. In cazul in care intampina probleme la utilizarea unui cont se trece automat la alegerea altuia. Scriptul ruleaza pana este inchis din task manager.

Pentru a putea fi utilizat, in acelasi director cu scriptul de mai jos trebuie sa existe:

putty.exe PuTTY Download Page

nologine.txt

nologine.txt contine conturile ssh(nologin), cate unul pe linie:

ip1:user1:parola1

ip2:user2:parola2

script:


#Python 2.7.*
#Copyright Rstforums.com

import random
import time
import subprocess
import datetime

#################config#################
port = "1080"
exchangetime = "120" # in secunde
sshlist = "nologine.txt"
########################################

dict = {}
i = 1
for line in open(sshlist,"r"):
line = line.rstrip()
sshlist = line.split(":")
dict[i] = sshlist
i = i+1

while True:
now = datetime.datetime.now()
aleator = random.randint(1, len(dict.keys()))
date = dict[aleator]
ip = date[0]
username = date[1]
password = date[2]
command = "putty.exe -D " + str(port) +" -l " + str(username) + " -pw " + str(password) + " -ssh " + str(ip)
print str(now.year) +"."+ str(now.month) +"."+ str(now.day) +" "+ str(now.hour) +":"+ str(now.minute) + " -->" + str(ip)
try:
puttyproc = subprocess.Popen(command)
time.sleep(int(exchangetime))
puttyproc.terminate()
except:
pass
#####
#End.
#####

Edited by Usr6
  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...