使用工具:python2.7,pyqt4,pyinstaller,pywin32

先贴代码

 import sys
from PyQt4 import QtGui,QtCore import threading
import thread
import os
import re
import urllib
import socket
import time global maxNum
global cnt
global sign class Main_QWidget(QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self) self.ipaddr=QtGui.QLineEdit(self)
self.portBegin=QtGui.QLineEdit(self)
self.portEnd=QtGui.QLineEdit(self)
self.GoButton=QtGui.QPushButton('Go',self)
self.out=QtGui.QTextBrowser() self.ipinfo=QtGui.QLabel("input the ip : ")
self.portinfo1=QtGui.QLabel("input the begin port : ")
self.portinfo2=QtGui.QLabel("input the end port : ")
self.resinfo=QtGui.QLabel(" the res : ") #self.status=QtGui.QTextBrowser() grid=QtGui.QGridLayout() grid.addWidget(self.ipinfo,0,0,1,3)
grid.addWidget(self.ipaddr,1,0,1,3) grid.addWidget(self.portinfo1,2,0,1,3)
grid.addWidget(self.portBegin,3,0,1,3) grid.addWidget(self.portinfo2,4,0,1,3)
grid.addWidget(self.portEnd,5,0,1,3) grid.addWidget(self.GoButton,6,0,1,3) grid.addWidget(self.resinfo,7,0,1,3)
grid.addWidget(self.out,8,0,1,3) #grid.addWidget(self.status,5,1,1,3) self.resize(300,600)
self.setLayout(grid)
self.setWindowTitle("find the open port = =") self.connect(self.GoButton,QtCore.SIGNAL('clicked()'),gogogo) def getIpAddr(self):
return self.ipaddr.text()
def getPortBegin(self):
return self.portBegin.text()
def getPortEnd(self):
return self.portEnd.text() def gogogo1():
print("hello,world\n")
print("ip :",main.ipaddr.text())
print("begin: ",main.portBegin.text())
print("end: ",main.portEnd.text())
main.out.append("??") def output(temp,interval):
main.out.append("open port: "+str(temp)) def tryconnect(temp,interval):
global cnt
global sign
s=socket.socket()
ttemp=int(temp)
t=s.connect_ex((main.ipaddr.text(),ttemp))
if t==0:
sign=1
#thread.start_new_thread(output,(temp,1))
main.out.append("open port: "+str(ttemp))
print(" find open port: ",ttemp)
cnt=cnt-1
thread.exit()
return True
else:
cnt=cnt-1
thread.exit()
return False def sleep(temp,interval):
time.sleep(1)
thread.exit() def gogogo():
global cnt
global maxNum
global sign
sign=0;
#main.GoButton.setEnabled(0)
main.out.append(" finding "+ main.ipaddr.text() + " open port ing...")
i=int(main.portBegin.text());
while i<=int(main.portEnd.text()):
print("threadnum= ", cnt,"port= ",i)
#main.status.append( "cnt= "+str(cnt)+"i= "+str(i) )
if( cnt < maxNum ):
thread.start_new_thread(tryconnect,(i,1))
i=i+1
cnt=cnt+1
#else:
# thread.start_new_thread(sleep,(1,1))
# time.sleep(0.1)
# print("waiting...")
if sign==0:
main.out.append(" no open port in range port...")
#main.GoButton.setEnabled(1)
return True if __name__=="__main__":
global maxNum
maxNum=800
global cnt
cnt=0 app=QtGui.QApplication(sys.argv)
main=Main_QWidget()
main.show()
sys.exit(app.exec_())

find_open_port

先说说遇到的问题,我是python菜鸟,昨天用python3.4写的,然后各种找,用到啥百度啥,最后终于让我把程序写好了,后来打包成exe文件时候遇到问题了,今天上午来卸载了3.4改成了2.7,用pyinstaller打包,成了!

先写这么多,到时候补充吧。

py2.7+pyqt4开发端口检测工具的更多相关文章

  1. TCP端口检测工具

    很多时候,我们需要测试 tcp 端口.ping 命令虽然好用,但不能测试端口,因为 ping 基于ICMP协议,属于IP层协议,所以无法测试传输层的 TCP/UDP 端口.幸好有tcping命令,可以 ...

  2. tcping端口检测工具使用

    大家都知道检测网络状态是,无论是服务器/客户机 最常用的就是ping命令,但ping命令只能检测ICMP协议,若对方禁止ping协议了,自然ping命令也就无法检测了,此时,我们可以通过tcping工 ...

  3. Python-通过socket实现一个小型的端口检测工具

    实验机器IP:192.168.220.139,端口开放情况 代码 # -*- coding:utf-8 -*- __author__ = "MuT6 Sch01aR" import ...

  4. tcping ,一个好用的TCP端口检测工具

    1.常用的用法(windows) tcp -w 10 -t -d -i 5 -j --color 81.156.165.66 443 2. http模式 -u,与-h命令连用,每一行输出目标的url ...

  5. 安全测试 - 端口嗅探工具Nmap

    Nmap 在官网下载nmap端口检测工具https://nmap.org/,nmap是一个网络连接端扫描软件,用来扫描网上电脑开放的网络连接端. 使用: 通过cmd命令:nmap www.5i5j.c ...

  6. Cocos开发中性能优化工具介绍之Visual Studio内存泄漏检测工具——Visual Leak Detector

    那么在Windows下有什么好的内存泄漏检测工具呢?微软提供Visual Studio开发工具本身没有什么太好的内存泄漏检测功能,我们可以使用第三方工具Visual Leak Detector(以下简 ...

  7. Xenu-web开发死链接检测工具应用

    Xenu 是一款深受业界好评,并被广泛使用的死链接检测工具. 时常检测网站并排除死链接,对网站的SEO 非常重要,因为大量死链接存在会降低用户和搜索引擎对网站的信任,web程序开发人员还可通过其找到死 ...

  8. 基于端口的弱口令检测工具--iscan

    亲手打造了一款弱口令检测工具,用Python编写,主要可以用于内网渗透.弱口令检测等方面,目前集成了常见端口服务,包含 系统弱口令:ftp.ssh.telnet.ipc$ 数据库弱口令:mssql.m ...

  9. Metasploit是一款开源的安全漏洞检测工具,

    Metasploit是一款开源的安全漏洞检测工具,可以帮助安全和IT专业人士识别安全性问题,验证漏洞的缓解措施,并管理专家驱动的安全性进行评估,适合于需要核实漏洞的安全专家,同时也适合于强大进攻能力的 ...

随机推荐

  1. 冲突--ScrollView嵌套ListView冲突问题的最优解决方案

    项目做多了之后,会发现其实 ScrollView嵌套ListVew或者GridView等很常用,但是你也会发现各种奇怪问题产生.根据个人经验现在列出常见问题以及代码最少最简单的解决方法. 问题一 :  ...

  2. 转--Android中自定义字体的实现方法

    1.Android系统默认支持三种字体,分别为:“sans”, “serif”, “monospace 2.在Android中可以引入其他字体 . 复制代码 代码如下: <?xml versio ...

  3. Makefile Shell 脚本;sed命令

    1. 在Makefile中想使用shell脚本,需要添加"@"符号,例如: @if [ -d xxx ]; then \                        //-d 判 ...

  4. 标准电流信号为什么是4-20MA?(网络摘录)

    一来源: 4-20mA.DC(1-5V.DC)信号制是国际电工委员会(IEC):过程控制系统(是连接仪表.变送设备.控制设备.计算机采样设备)用模拟信号标准.我国从DDZ-Ⅲ型电动仪表开始采用这一国际 ...

  5. 区分DPI、分辨率(PPI)、图像的物理大小、像素宽度

    分辨率都知道,越高越清晰. 一.描述分辨率的单位有:    dpi(点每英寸).lpi(线每英寸)和ppi(像素每英寸).但只有lpi是描述光学分辨率的尺度的.虽然dpi和ppi也属于分辨率范畴内的单 ...

  6. js中如何操作json数据

    一.要想熟练的操作json数据,就先要了解json数据的结构,json有两种结构:对象和数组. 1.对象 一个对象以“{”开始,“}”结束.每个“名称”后跟一个“:”:“‘名称/值’ 对”之间使用“, ...

  7. oracle游标循环的嵌套

    完成批量修改user_tables中的所有表的栏位名(从MS SQL导入过来,发现大小写问题,造成很多麻烦) 存储过程见下: -- Created on 2012/3/14 by FREE decla ...

  8. 基于lucene实现自己的推荐引擎

    基于lucene实现自己的推荐引擎 推荐常用算法之-基于内容的推荐 推荐算法

  9. 动态添加js文件.

    方法一: $.getScript(url,callback); 这个方法是对$.ajax({ })的封装.默认是异步的而且是带有缓存的. 缓存对于用户来说,是个好东西,但是对于开发者来说可就是日了狗的 ...

  10. 监控RAC中的临时表空间

    it is from metalink:Note:465840.1 1>Monitor the temp space allocation to make sure each instance ...