Jun-29-2017, 06:17 PM
(This post was last modified: Jun-29-2017, 06:22 PM by Kaos_Method.)
Hey everyone!
I'm new here, first post! I've put quite a fair amount of time into Python now, and I'm really enjoying it. I'm a CS major, and I've learned more from the community then I think I'll learn about Python through out my entire time in college. Anyway, on to my question!
Botnet really interests me a lot (nothing nefarious, just interested). I've done a fair amount of research and looking around, and I think I understand the majority of the code that is used (I will list it below). I have a few questions in regards to using something like this though. Having read about SSH a fair amount, doesn't it prevent Brute Force like attacks?
Also, this isn't my code. I found it and changed it just a little. Not very much, more to try to make it work with Python 3, because it was originally written in Python 2. The import command didn't work ether, so I changed that to make it work. Also, I have a question about variables, specifically about "s = pxssh.pxssh()". I understand the concept of a variable, but nothing I've seen explains why you would do it like that. I'm trying to understand why it goes pxssh.pxssh(), rather then just s = pxssh. Also, why not globally define the variable in the beginning, under the import functions? I've seen and read a fair amount where people talk about "thinking in a Pythonic way". A lot of what I've seen on this talks about defining variables in the beginning. Why would this not be done?
Still quite new to all of this, and I know my questions are quite simplistic. Thanks everyone!
I had it formatted before, and for some reason I can't seem to get the code to stay formatted.
I'm new here, first post! I've put quite a fair amount of time into Python now, and I'm really enjoying it. I'm a CS major, and I've learned more from the community then I think I'll learn about Python through out my entire time in college. Anyway, on to my question!
Botnet really interests me a lot (nothing nefarious, just interested). I've done a fair amount of research and looking around, and I think I understand the majority of the code that is used (I will list it below). I have a few questions in regards to using something like this though. Having read about SSH a fair amount, doesn't it prevent Brute Force like attacks?
Also, this isn't my code. I found it and changed it just a little. Not very much, more to try to make it work with Python 3, because it was originally written in Python 2. The import command didn't work ether, so I changed that to make it work. Also, I have a question about variables, specifically about "s = pxssh.pxssh()". I understand the concept of a variable, but nothing I've seen explains why you would do it like that. I'm trying to understand why it goes pxssh.pxssh(), rather then just s = pxssh. Also, why not globally define the variable in the beginning, under the import functions? I've seen and read a fair amount where people talk about "thinking in a Pythonic way". A lot of what I've seen on this talks about defining variables in the beginning. Why would this not be done?
Still quite new to all of this, and I know my questions are quite simplistic. Thanks everyone!
from pexpect import pxssh class Client: def __init__(self, host, user, password): self.host = host self.user = user self.password = password self.session = self.connect() def connect(self): try: s = pxssh.pxssh() s.login(self.host, self.user, self.password) return s excempt Exception as e: print (e) print ('[-] Error Connecting') def send_command(self, cmd): self.session.sendline(cmd) self.session.prompt() return self.session.before def botnetcommand(command): for Client in botnet: output = Client.send_command(command) print (' [*] Output from ') + client.host print (' [*]') + output def addClient(host, user, password): client = Client(host, user, password) botnet.aapend(client) botnet = [] addClient() botnetcommand('ls -la')
I had it formatted before, and for some reason I can't seem to get the code to stay formatted.