我试图在我的设置模块中调用我的方法hello,但是它应该可以很好地与from shodan.shodan import myclass
一起工作,但是它似乎不适合文件结构,并且导入文件和调用。这是我正在做的练习的一个原型,但它似乎不适用于类和打印hello方法
.
├── core
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── settings.py
│ └── settings.pyc
├── google
│ ├── google.py
│ ├── google.pyc
│ ├── __init__.py
│ ├── __init__.pyc
│ └── modules
│ ├── images.py
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── utils.py
│ └── utils.pyc
├── loop.sh
├── main.py
├── names
├── shodan
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── shodan.py
│ └── shodan.pyc
└── unix.sh
你知道吗设置.py你知道吗
from optparse import OptionParser
from sys import platform as _platform
from google.google import *
from shodan.shodan import *
def settings(argv=None):
if _platform == "linux" or _platform == "linux2":
#Linux
CrossPlatformCommandLineParser()
elif _platform == "darwin":
# MAC OS X
CrossPlatformCommandLineParser()
elif _platform == "win32":
# Windows
CrossPlatformCommandLineParser()
elif _platform == "win64":
# Windows 64-bit
CrossPlatformCommandLineParser()
def CrossPlatformCommandLineParser(argv=None):
if _platform == "linux" or _platform == "linux2":
#Linux
#print 'Linux ' + 'new cyber weapon'
#google()
shodan = Shodan()
shodan.hello()
elif _platform == "darwin":
# MAC OS X
print 2
elif _platform == "win32":
# Windows
print 3
elif _platform == "win64":
# Windows 64-bit
print 4
你知道吗肖丹.py你知道吗
#!/usr/bin/python
class Shodan:
"""docstring for ClassName"""
def __init__(self, key):
self.key = "aaa"
def hello():
print '[+] shodan...' + self.key
你知道吗主.py你知道吗
#!/usr/bin/python
import sys
import core.settings
if __name__ == '__main__':
try:
core.settings.settings()
except KeyboardInterrupt:
print "interrupted by user.."
except:
sys.exit()
你可以在家里试试这样的东西设置.py你知道吗
导入整个shodan文件。然后尝试创建Shodan类的对象,并使用该对象调用hello方法。你知道吗
这将导致您的设置.py像这样归档。你知道吗
修改您的shodan如下:
观察中的变化设置.py用于对象创建。 shodanObject=肖丹。肖丹(“aaa”)这一行。你知道吗
相关问题 更多 >
编程相关推荐