base.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:NS_Proj 作者: drstarry 项目源码 文件源码
def Start(self, serverAddress, serverPort, bruteforce_file):
        """
        serverHost = string: localhost/ip address/url for server
        serverPort = int: port number to connect for server
        bruteforce_file = string: name of the file that has password guesses
        """
        serverSckt = socket(AF_INET, SOCK_STREAM)
        serverSckt.connect((serverAddress, serverPort))
        print "Client: Connected to Server at %s:%d" \
            % (serverAddress, serverPort)

        success, time_taken, attempts = self.Client(serverSckt, bruteforce_file)
        # used to close socket when client is done
        serverSckt.sendCloseSignal()

        if success:
            print "Success! Cracked the password and got in."
        else:
            print "Failure! Tried to get in but couldn't."

        print "Took %d guesses and %d seconds." \
            % (attempts, time_taken.seconds)

        serverSckt.shutdown(1)  # send close signal to server socket
        serverSckt.close()  # close connection
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号