Python Network Security Programming-1
UNIX口令破解
1.程序运行需求:
其中dictionary.txt文件为破解口令的字典文件,passwords.txt文件为临时存放UNIX系统密码的文件
2.程序源码:
import crypt
# 以hash方式加密的unix口令,的一般形式为:HXajgneuer/jids 其中前两位“HX”一般称为salt ,剩下的字符不影响哈希结果
# salt是此哈希的盐值,长度是8位,超过8的后面的位数将不影响哈希的结果。
# 在正常情况下,进行加密的时候,这个盐值是随机字符串。
def testPass(cryptPass):
# 根据字典通过crypt函数判断密码
salt = cryptPass[0:2] # 读哈希值得前两位
dictFile = open('dictionary.txt','r')
for word in dictFile.readlines():
word = word.strip('\n') # 清除头尾空格,回车符等
# print(word,salt)
cryptWord = crypt.crypt(word,salt) #使用字典数据利用crypt函数构造密码
# print(cryptWord,cryptPass)
if cryptWord==cryptPass:
print("[+] Found Fassword: " + word + "\n")
else:
print("[-] PassWord Not Find !\n") def main():
passFile = open('passwords.txt')
for line in passFile.readlines():
if ":" in line:
user = line.split(':')[0] #将password中的数据以 “:” 分为user和password两部分,此为user部分
cryptPass = line.split(':')[1].strip('\n') #此为password部分
print("[*] Cracking Password For: "+user)
testPass(cryptPass) #调用检测比对函数 if __name__ == '__main__':
main()
Python Network Security Programming-1的更多相关文章
- python network programming tutorial
关于网络编程以及socket 等一些概念和函数介绍就不再重复了,这里示例性用python 编写客户端和服务器端. 一.最简单的客户端流程: 1. Create a socket 2. Connect ...
- android9.0适配HTTPS:not permitted by network security policy'
app功能接口正常,其他手机运行OK,但是在Android9.0的手机上报错 CLEARTEXT communication to 192.168.1.xx not permitted by netw ...
- Android版本28使用http请求报错not permitted by network security policy
Android版本28使用http请求报错not permitted by network security policy android模拟器调试登录的时候报错 CLEARTEXT communic ...
- 《Network Security A Decision and Game Theoretic Approach》阅读笔记
网络安全问题的背景 网络安全研究的内容包括很多方面,作者形象比喻为盲人摸象,不同领域的网络安全专家对网络安全的认识是不同的. For researchers in the field of crypt ...
- Azure PowerShell (13) 批量设置Azure ARM Network Security Group (NSG)
<Windows Azure Platform 系列文章目录> 刚刚在帮助一个合作伙伴研究需求,他们的虚拟机全面的网络安全组(Network Security Group, NSG)会经常 ...
- Network Security Services If you want to add support for SSL, S/MIME, or other Internet security standards to your application, you can use Network Security Services (NSS) to implement all your securi
Network Security Services | MDN https://developer.mozilla.org/zh-CN/docs/NSS 网络安全服务 (NSS) 是一组旨在支持支持安 ...
- Network Security Threats
Network Security Combination of low-cost powerful computing and high-performance networks is a two-e ...
- Firewall & Network Security
Firewall & Network Security 防火墙 & 网络安全 NAT Gateway VPC Virtual Private Cloud refs https://en ...
- Python Lambda & Functional Programming
Python Lambda & Functional Programming 函数式编程 匿名函数 纯函数 高阶函数 # higher-order functions def apply_tw ...
随机推荐
- Elasticsearch:search template
我们发现一些用户经常编写了一些非常冗长和复杂的查询 - 在很多情况下,相同的查询会一遍又一遍地执行,但是会有一些不同的值作为参数来查询.在这种情况下,我们觉得使用一个search template(搜 ...
- Codeforces Round #586 (Div. 1 + Div. 2) A. Cards
链接: https://codeforces.com/contest/1220/problem/A 题意: When Serezha was three years old, he was given ...
- python计算余弦复杂度
import numpy as np from sklearn.metrics.pairwise import cosine_similarity a = np.array([1, 2, 3, 4]) ...
- sqlserver 插入语句
//--创建事务 Create PROC [dbo].[proc_XXXXX] ) AS BEGIN BEGIN TRAN BEGIN TRY .....................插入 COMM ...
- 解决CMD控制台乱码问题
在cmd控制台中出现乱码情况如下 解决方式1 在控制台中输入 CHCP65001 按enter回车键查看 注:CHCP是一个计算机指令,能够显示或设置活动代码页编号. 代码页 描述6500 ...
- MFC 画笔CPen、画刷CBrush
新建单个文档的MFC应用程序,类视图——View项的属性——消息,WM_PAINT,创建OnPaint()函数 dc默认有一个画笔(实心1像素宽黑线). CPen画笔非实心线像素宽必须为1,否则膨胀接 ...
- Error: 'The service did not respond in a timely fashion'
Windows启动时候报这个错,不应在OnStart放执行长的过程,需要开另一个线程来做才能顺利启动 Windows Services: OnStart loop - do I need to del ...
- 在 CentOS 7 上安装 RabbitMQ
RabbitMQ 服务器在安装之前需要安装 erlang. 最新版本的 RabbitMQ 3.8.0 需要 Erlang 21.3 以上的版本支持. 在这里,我们需要在你的 CentOS 中安装 Er ...
- c/c++读取一行可以包含空格的字符串(getline,fgets用法)
1.char[]型 char buf[1000005]; cin.getline(buf,sizeof(buf)); 多行文件输入的情况: while(cin.getline(buf,sizeof(b ...
- javascript原型继承
在传统的基于Class的语言如Java.C++中,继承的本质是扩展一个已有的Class,并生成新的Subclass. 由于这类语言严格区分类和实例,继承实际上是类型的扩展.但是,JavaScript由 ...