python---把tab.py的tab键自动补齐命令脚本,放入包目录下,python所有文件都可以使用

把tab.py的tab键自动补齐命令,放入包目录下,python所有文件都可以使用

root@kali:~/python/snmp# ls /usr/lib/python2.7/dist-packages/
ADNS.py                                        IPy.py                                         pyparsing.pyc
adns_python-1.2.1.egg-info                     jsonpickle                                     PyQt4
adns.so                                        jsonpickle-0.4.0.egg-info                      pyqtgraph
ANSI.py                                        keepnote                                       pyqtgraph-0.0.0.egg-info
apt                                            keepnote-0.7.8.egg-info                        pyscard-1.6.14.egg-info
apt_inst.so                                    ldb.so                                         pyserial-2.5.egg-info
apt_pkg.so                                     libexiv2python.so                              PySide
aptsources                                     libmproxy                                      pysnmp
argcomplete                                    libxml2mod.so                                  pysnmp-4.2.2.egg-info
argcomplete-0.8.1.egg-info                     libxml2.py                                     pysnmp_apps
async                                          libxsltmod.so                                  pysnmp_apps-0.3.2.egg-info
async-0.6.1.egg-info                           libxslt.py                                     pysnmp_mibs
backports                                      louis                                          pysnmp_mibs-0.1.3.egg-info
backports.ssl_match_hostname-3.4.0.2.egg-info  louis-2.4.1.egg-info                           pysqlite2
bbqsql                                         lsb_release.py                                 pysqlite-2.6.3.egg-info
BBQSQL-1.0.egg-info                            lsb_release.pyc                                pysvn
BeautifulSoup-3.2.1.egg-info                   lxml                                           python_apt-0.8.8.2.egg-info
beautifulsoup4-4.1.0.egg-info                  lxml-2.3.2.egg-info                            python_dateutil-1.5.egg-info
BeautifulSoup.py                               M2Crypto                                       python_debian-0.1.21.egg-info
BeautifulSoup.pyc                              M2Crypto-0.21.1.egg-info                       python_ntlm-1.0.1.egg-info
BeautifulSoupTests.py                          Magic_file_extensions-0.2.egg-info             python-support.pth
binwalk                                        magic.py                                       pytidylib-0.2.1.egg-info
binwalk-2.0.0.egg-info                         magic.pyc                                      pytz
bitarray                                       mechanize                                      pytz-2012c.egg-info
bitarray-0.8.0.egg-info                        mechanize-0.2.5.egg-info                       pyusb-1.0.0a3.egg-info
blindelephant                                  mercurial                                      pyx
BlindElephant-1.0.egg-info                     mercurial-2.2.2.egg-info                       PyX-0.11.1.egg-info
Brlapi-0.5.7.egg-info                          metaconfig                                     PyYAML-3.10.egg-info
brlapi.so                                      metaconfig-0.1.4a1.egg-info                    radialnet
bs4                                            mitmproxy-0.11.3.egg-info                      README
bson                                           mx                                             requests
caribou                                        MySQLdb                                        requests-0.12.1.egg-info
cffi                                           _mysql_exceptions.py                           rfidiot
cffi-0.8.1.egg-info                            _mysql_exceptions.pyc                          rfidiot-1.0.egg-info
_cffi_backend.so                               MySQL_python-1.2.3.egg-info                    samba
chardet                                        _mysql.so                                      scapy
chardet-2.0.1.egg-info                         ndiff.py                                       scapy-2.2.0.egg-info
clamd-1.0.1.egg-info                           netaddr                                        scipy
clamd.py                                       netaddr-0.7.7.egg-info                         scipy-0.10.1.egg-info
colorama                                       netlib                                         screen.py
colorama-0.2.4.egg-info                        netlib-0.11.1.egg-info                         serial
ConfigArgParse-0.9.3.egg-info                  nfspy                                          setuptools
configargparse.py                              NfSpy-1.0.egg-info                             setuptools.egg-info
configobj-4.7.2.egg-info                       nltk                                           setuptools.pth
configobj.py                                   nltk-2.0.4.egg-info                            simplejson
Crypto                                         nose                                           simplejson-2.5.2.egg-info
cryptography                                   nose-1.1.2.egg-info                            sipconfig_nd.py
cryptography-0.6.1.egg-info                    ntlm                                           sipconfig.py
d2to1                                          oauth                                          sip.so
d2to1-0.2.7.egg-info                           oauth-1.0.1.egg-info                           site.py
darts                                          oauthlib                                       six-1.8.0.egg-info
darts.util.lru-0.5.egg-info                    oauthlib-0.1.2.egg-info                        six.py
darts.util.lru-0.5-nspkg.pth                   OpenGL                                         smartcard
dateutil                                       OpenSSL                                        smmap
dbus                                           packagekit                                     smmap-0.8.2.egg-info
_dbus_bindings.so                              PAM-0.4.2.egg-info                             speechd
_dbus_glib_bindings.so                         PAMmodule.so                                   speechd_config
deb822.py                                      paramiko                                       sqlalchemy
debconf.py                                     paramiko-1.7.7.1.egg-info                      SQLAlchemy-0.7.8.egg-info
debian                                         passlib                                        talloc.so
debian_bundle                                  passlib-1.5.3.egg-info                         tdb.so
dff                                            pcapy-0.10.8.egg-info                          tests
dissy                                          pcapy.so                                       tidylib
dissy-9.egg-info                               pdfminer                                       tornado
distorm3                                       pdfminer-20110515.egg-info                     tornado-4.0.2.egg-info
distorm3-3.egg-info                            pexpect-2.4.egg-info                           tweepy
distribute-0.6.24dev_r0.egg-info               pexpect.py                                     tweepy-1.7.1.egg-info
dns                                            pexpect.pyc                                    twisted
DNS                                            phply                                          Twisted-12.0.0.egg-info
DNSBL.py                                       phply-dev.egg-info                             Twisted_Conch-12.0.0.egg-info
dnspython-1.10.0.egg-info                      phply-dev-nspkg.pth                            Twisted_Core-12.0.0.egg-info
drv_libxml2.py                                 PIL                                            Twisted_Lore-12.0.0.egg-info
easygui-0.96.egg-info                          PIL.pth                                        Twisted_Mail-12.0.0.egg-info
easygui.py                                     pip                                            Twisted_Names-12.0.0.egg-info
easy-install.pth                               pip-1.1.egg-info                               Twisted_News-12.0.0.egg-info
easy_install.py                                pkg_resources.py                               Twisted_Runner-12.0.0.egg-info
esmre-0.3.1.egg-info                           pkg_resources.pyc                              Twisted_Web-12.0.0.egg-info
esmre.py                                       ply                                            Twisted_Words-12.0.0.egg-info
esm.so                                         ply-3.4.egg-info                               urwid
fdpexpect.py                                   psycopg2                                       urwid-1.0.1.egg-info
FSM.py                                         psycopg2-2.4.5.egg-info                        usb
fuseparts                                      pxssh.py                                       validate.py
fuse.py                                        pyasn1                                         volatility
fuse_python-0.2.1.egg-info                     pyasn1-0.1.3.egg-info                          volatility-2.4.egg-info
gi                                             pyatspi                                        wapiti-2.3.0.egg-info
git                                            pybloomfiltermmap-0.3.11-py2.7-linux-i686.egg  wapitiCore
gitdb                                          pycparser                                      wx-2.8-gtk2-unicode
gitdb-0.5.4.egg-info                           pycparser-2.07.egg-info                        wx.pth
github                                         pycrypto-2.6.egg-info                          wxPython_common-2.8.12.1.egg-info
GitPython-0.3.2.RC1.egg-info                   pycryptopp                                     wxversion.py
glib                                           pycryptopp-0.5.29.egg-info                     xapian
gobject                                        pydns-2.3.6.egg-info                           xdot-0.5.egg-info
gridfs                                         pyexiv2                                        xdot.py
gtk-2.0                                        PyGithub-1.23.0.egg-info                       yaml
gtk-2.0-pysupport-compat.pth                   pygments                                       _yaml.so
gtksourceview2.so                              Pygments-1.5.egg-info                          yara_python-1.7.egg-info
guess_language                                 pygtk.pth                                      yara.so
guess_language-0.2.egg-info                    pygtk.py                                       zenmap-6.47.egg-info
Halberd                                        pygtk.pyc                                      zenmapCore
halberd-0.2.4.egg-info                         pymongo                                        zenmapGUI
hgext                                          pymongo-2.2.egg-info                           zim
httplib2                                       PyOpenGL-3.0.1.egg-info                        zim-0.56.egg-info
httplib2-0.7.4.egg-info                        pyOpenSSL-0.14.egg-info                        zope
invest                                         pyparsing-1.5.6.egg-info                       zope.interface-3.6.1.egg-info
IPy-0.75.egg-info                              pyparsing.py                                   zope.interface-3.6.1-nspkg.pth


#tab.py的tab键自动补齐命令脚本
root@kali:~/python/snmp# cat /root/python/snmp/tab.py 
#pyhton startup file
import sys
import readline
import rlcompleter
import atexit
import os
#tab completion
readline.parse_and_bind('tab:complete')
#history file
histfile = os.path.join(os.environ['HOME'],'.pythonhistory')
try:
    readline.read_history_file(histfile)
except IOError:
    pass
atexit.register(readline.write_history_file,histfile)

del os, histfile, readline, rlcompleter


#复制到python2.7主目录下
root@kali:~/python/snmp# cp /root/python/snmp/tab.py /usr/lib/python2.7/dist-packages/
root@kali:~/python/snmp# python
Python 2.7.3 (default, Mar 14 2014, 11:57:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
root@kali:~/python/snmp# 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

徐为波

看着给就好了,学习写作有点累!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值