资源简介
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工具箱\ba
文件 563200 2010-10-25 07:15 GOW工具箱\bash.exe
文件 88064 2005-03-08 09:54 GOW工具箱\bc.exe
文件 279552 2009-05-05 10:17 GOW工具箱\bison.exe
文件 38400 2008-03-21 08:12 GOW工具箱\bunzip2.exe
文件 69120 2008-03-21 08:12 GOW工具箱\bzip2.dll
文件 38400 2008-03-21 08:12 GOW工具箱\bzip2.exe
文件 19456 2008-03-21 08:12 GOW工具箱\bzip2recover.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个文件信息
评论
共有 条评论