Windows超级命令行工具箱


windows的超级命令行工具箱,很多工具,有很多很NB的工具哦!
资源截图
代码片段和文件信息
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import socket
import threading
import logging
import optparse


class PipeThread(threading.Thread):

    def __init__(self source_fd target_fd):
        super(PipeThread self).__init__()
        self.logger = logging.getLogger(‘PipeThread‘)
        self.source_fd = source_fd
        self.target_fd = target_fd
        self.source_addr = self.source_fd.getpeername()
        self.target_addr = self.target_fd.getpeername()

    def run(self):
        while True:
            try:
                data = self.source_fd.recv(4096)
                if len(data) > 0:
                    self.logger.debug(‘read  %04i from %s:%d‘ len(data)
                                      self.source_addr[0] self.source_addr[1])
                    sent = self.target_fd.send(data)
                    self.logger.debug(‘write %04i to   %s:%d‘ sent
                                      self.target_addr[0] self.target_addr[1])
                else:
                    break
            except socket.error:
                break
        self.logger.debug(‘connection %s:%d is closed.‘ self.source_addr[0]
                          self.source_addr[1])
        self.logger.debug(‘connection %s:%d is closed.‘ self.target_addr[0]
                          self.target_addr[1])
        self.source_fd.close()
        self.target_fd.close()


class Forwarder(object):

    def __init__(self ip port remoteip remoteport backlog=5):
        self.remoteip = remoteip
        self.remoteport = remoteport
        self.sock = socket.socket(socket.AF_INET socket.SOCK_STREAM)
        self.sock.setsockopt(socket.SOL_SOCKET socket.SO_REUSEADDR 1)
        self.sock.bind((ip port))
        self.sock.listen(backlog)

    def run(self):
        while True:
            client_fd client_addr = self.sock.accept()
            target_fd = socket.socket(socket.AF_INET socket.SOCK_STREAM)
            target_fd.connect((self.remoteip self.remoteport))

            threads = [
                PipeThread(client_fd target_fd)
                PipeThread(target_fd client_fd)
            ]

            for t in threads:
                t.setDaemon(True)
                t.start()

    def __del__(self):
        self.sock.close()


if __name__ == ‘__main__‘:
    parser = optparse.OptionParser()

    parser.add_option(
        ‘-l‘ ‘--local-ip‘ dest=‘local_ip‘
        help=‘Local IP address to bind to‘)
    parser.add_option(
        ‘-p‘ ‘--local-port‘
        type=‘int‘ dest=‘local_port‘
        help=‘Local port to bind to‘)
    parser.add_option(
        ‘-r‘ ‘--remote-ip‘ dest=‘remote_ip‘
        help=‘Local IP address to bind to‘)
    parser.add_option(
        ‘-P‘ ‘--remote-port‘
        type=‘int‘ dest=‘remote_port‘
        help=‘Remote port to bind to‘)
    parser.add_option(
        ‘-v‘ ‘--verbose‘
        action=‘stor

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     352768  2008-02-11 02:30  GOW工具箱awk.exe

     文件      23552  2005-04-21 08:41  GOW工具箱asename.exe

     文件     563200  2010-10-25 07:15  GOW工具箱ash.exe

     文件      88064  2005-03-08 09:54  GOW工具箱c.exe

     文件     279552  2009-05-05 10:17  GOW工具箱ison.exe

     文件      38400  2008-03-21 08:12  GOW工具箱unzip2.exe

     文件      69120  2008-03-21 08:12  GOW工具箱zip2.dll

     文件      38400  2008-03-21 08:12  GOW工具箱zip2.exe

     文件      19456  2008-03-21 08:12  GOW工具箱zip2recover.exe

     文件      62464  2005-04-21 08:41  GOW工具箱cat.exe

     文件      83968  2005-04-21 08:41  GOW工具箱chgrp.exe

     文件      81920  2005-04-21 08:41  GOW工具箱chmod.exe

     文件      86016  2005-04-21 08:41  GOW工具箱chown.exe

     文件      24576  2005-04-21 08:41  GOW工具箱chroot.exe

     文件      25600  2005-04-21 08:41  GOW工具箱cksum.exe

     文件         16  2012-09-10 23:28  GOW工具箱clear.bat

     文件     130048  2005-04-21 08:41  GOW工具箱cp.exe

     文件      76288  2005-04-21 08:41  GOW工具箱csplit.exe

     文件    1731072  2014-02-11 12:15  GOW工具箱curl.exe

     文件      38912  2005-04-21 08:41  GOW工具箱cut.exe

     文件      51200  2005-03-08 09:54  GOW工具箱dc.exe

     文件      87552  2005-04-21 08:41  GOW工具箱dd.exe

     文件      81920  2005-04-21 08:42  GOW工具箱df.exe

     文件     150528  2004-05-25 02:46  GOW工具箱diff.exe

     文件      59392  2004-05-25 02:46  GOW工具箱diff3.exe

     文件      24064  2005-04-21 08:41  GOW工具箱dirname.exe

     文件      40960  2000-10-11 22:55  GOW工具箱dos2unix.exe

     文件     108544  2005-04-21 08:41  GOW工具箱du.exe

     文件      92160  2009-02-13 21:19  GOW工具箱egrep.exe

     文件      24064  2005-04-21 08:41  GOW工具箱env.exe

............此处省略179个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)