Stack Overflow我有一个问题。我是python的新手,但我正在尝试制作一个黑客助手,只会通过询问来运行攻击和扫描。我刚刚开始昨晚,我想制作一个基本的端口扫描程序,我在另一个.py文件中编写了端口扫描程序,现在如果用户键入" port scanner" "你会为我扫描一个端口吗?"等等 每当我输入笑话时,它都不会运行代码的笑话,它只运行端口扫描程序......
# coding: utf-8
#!/usr/bin/env python
import time
if Home == "portscanner" or "Portscanner" or "Will you scan a port for me?":
portscanner()
######This starts the code for the machine responding with jokes
if Home == "Tell me a joke" or "Joke" or "joke" or "do you know any jokes?" or "Do you know any jokes":
#Joke section this is purely cosmetic and funny for the user gonna add more features like this
from random import *
def joke():
joke1 = "I like telling UDP jokes because I don't care if you don't get them"
joke2 = "CAPS LOCK - Preventing Login Since 1980."
joke3 = "In a world without fences and walls, who needs Gates and Windows?"
joke4 = "I once had an idea.....oh wait nope that was my maker...I'm a program...I don't have ideas"
joke5 = "Programmers are tools for converting caffeine into code."
joke6 = "Hacking is like sex...You get in, you get out, and hope that you didn’t leave something that can be traced back to you."
joke7 = "!false - its funny because its true"
joke8 = "<joke>Joke Here</joke>"
joke9 = "Hide&Seek champion - ; - Since 1958"
headers = [joke1, joke2, joke3, joke4, joke5, joke6, joke7, joke8, joke9]
print headers[randint(0,8)]
答案 0 :(得分:0)
使用scanner.py
创建文件:
def scan():
# Do you scan
然后在你的主文件中从用户获取一个字符串:
import scanner
Home = input()
if Home == "portscanner" or "Portscanner" or "Will you scan a port for me?":
scanner.scan()