Python Ethical Hacking - NETWORK_SCANNER(2)
DICTIONARIES
- Similar to lists but use key instead of an index.
LISTS
- List of values/elements, all can be stored in one variable.
Improving the Program Using a List of Dictionaries:
#!/usr/bin/env python import scapy.all as scapy def scan(ip):
arp_request = scapy.ARP(pdst=ip)
broadcast = scapy.Ether(dst="ff:ff:ff:ff:ff:ff")
arp_request_broadcast = broadcast/arp_request
answered_list = scapy.srp(arp_request_broadcast, timeout=1, verbose=False)[0] clients_list = []
for element in answered_list:
clients_dict = {"ip": element[1].psrc, "mac": element[1].hwsrc}
clients_list.append(clients_dict)
return clients_list def print_result(results_list):
print("IP\t\t\tMAC Address\n------------------------------------------")
for client in results_list:
print(client["ip"] + "\t\t" + client["mac"]) scan_result = scan("10.0.0.1/24")
print_result(scan_result)
Result:
Complete the Python code:
#!/usr/bin/env python import scapy.all as scapy
import argparse def get_arguments():
parser = argparse.ArgumentParser()
parser.add_argument("-t", "--target", dest="target", help="Target IP / IP range.")
options = parser.parse_args()
return options def scan(ip):
arp_request = scapy.ARP(pdst=ip)
broadcast = scapy.Ether(dst="ff:ff:ff:ff:ff:ff")
arp_request_broadcast = broadcast/arp_request
answered_list = scapy.srp(arp_request_broadcast, timeout=1, verbose=False)[0] clients_list = []
for element in answered_list:
clients_dict = {"ip": element[1].psrc, "mac": element[1].hwsrc}
clients_list.append(clients_dict)
return clients_list def print_result(results_list):
print("IP\t\t\tMAC Address\n------------------------------------------")
for client in results_list:
print(client["ip"] + "\t\t" + client["mac"]) options = get_arguments()
scan_result = scan(options.target)
print_result(scan_result)
Python Ethical Hacking - NETWORK_SCANNER(2)的更多相关文章
- Python Ethical Hacking - NETWORK_SCANNER(1)
NETWORK_SCANNER Discover all devices on the network. Display their IP address. Display their MAC add ...
- Python Ethical Hacking - BACKDOORS(8)
Cross-platform hacking All programs we wrote are pure python programs They do not rely on OS-specifi ...
- Python Ethical Hacking - ARP Spoofing
Typical Network ARP Spoofing Why ARP Spoofing is possible: 1. Clients accept responses even if they ...
- Python Ethical Hacking - MAC Address & How to Change(3)
SIMPLE ALGORITHM Goal -> Check if MAC address was changed. Steps: 1. Execute and read ifconfig. ...
- Python Ethical Hacking - MAC Address & How to Change(2)
FUNCTIONS Set of instructions to carry out a task. Can take input, and return a result. Make the cod ...
- Python Ethical Hacking - MAC Address & How to Change(1)
MAC ADDRESS Media Access Control Permanent Physical Unique Assigned by manufacturer WHY CHANGE THE M ...
- Python Ethical Hacking - The Lab and Needed Software
The Lab and Needed Software Attacker Machine - Kali Linux https://www.kali.org/ 1. Install the softw ...
- Python Ethical Hacking - Basic Concetion
What is Hacking? Gaining unauthorized access. Hackers? 1.Black-hat Hackers 2.White-hat Hackers 3.Gre ...
- Python Ethical Hacking - VULNERABILITY SCANNER(9)
Automatically Discovering Vulnerabilities Using the Vulnerability Scanner 1. Modify the run_scanner ...
随机推荐
- VS Code WebApi系列——3、发布
上两篇已经实现了WebApi及基于jwt的Token设置,那么功能做完了,该发布WebApi了.为什么要对发布进行一下说明呢,因为是基于vscode和.netcore的发布,所以可能会遇到莫名奇妙的问 ...
- Probius:一个功能强大的自定义任务系统
断更的这些日子,我又折腾了一个轮子,文末参考源码 大约在一年半以前写过一篇文章『探秘varian:优雅的发布部署程序』,里边有讲到我们采用类似lego的模块化方式来构建CICD的流程,虽能满足我们的需 ...
- sqlserver导致服务器异常卡死
1.业务反应,服务器三天两头就要重启一次,要不然直接hang掉,登上服务器,异常的慢,大概进去需要十分钟的时间,查看一下电脑配置,8核8G的物理机. 2.查看一下任务管理器中的资源使用情况,发现cpu ...
- DNS区域传输和DNS字典爆破
nslookup命令是已知域名的的解析记录下进行的查询.打个比方,已知sina.com这个域名有www.sina.com这条主机解析记录,就可以查询www.sina.com对应的ip以及其他相关信息. ...
- 【JAVA8新的时间与日期 API】- 传统时间格式化的线程安全问题
Java8之前的日期和时间API,存在一些问题,最重要的就是线程安全的问题.这些问题都在Java8中的日期和时间API中得到了解决,而且Java8中的日期和时间API更加强大. 传统时间格式化的线程安 ...
- web如何测试
当我们负责web测试的时候,先了解B/S架构,然后分析如何开始执行测试,一般步骤:从功能测试,兼容测试,安全测试. 功能测试: 一.链接测试,链接是web应用系统的一个很重要的特征,主要是用于页面之间 ...
- 并发04--JAVA中的锁
1.Lock接口 Lock与Synchronized实现效果一致,通过获得锁.释放锁等操作来控制多个线程访问共享资源,但是Synchronized将获取锁固话,必须先获得锁,再执行,因此两者对比来说, ...
- 【spring boot】spring boot 拦截器
今日份代码: 1.定义拦截器 import com.alibaba.fastjson.JSON; import org.apache.commons.collections.CollectionUti ...
- 鹅厂车联网探索:5G下边缘云计算的车路协同实践
5G网络下,多接入边缘计算(MEC)应运而生.结合TKEStack强大的集群管理能力和异构计算资源管理能力,腾讯打造了一个功能完备的边缘计算PaaS平台TMEC,提供了高精确度定位.视频处理.无线网络 ...
- 洛谷 P5683 【[CSPJX2019]道路拆除】
先用做的暴力,因为n最多才3000嘛,但是后来发现时间复杂度不止\(O\)(\({n}^2\)),然后就放弃了. 讲讲我的暴力+错误思路吧: 把1到s1和s2的最短路算出来,用SPFA,然后用DFS求 ...