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 ...
随机推荐
- vc6.0转vs2012的一些错误与解决方法
1>------ 已启动生成: 项目: NMW210, 配置: Debug Win32 ------ abs_position = fabs((float)posiTemp1 - (float) ...
- 使用word2016发有代码高亮的博客
复制使用notepad++,eclipse这类有高亮的编辑器编写的代码到word中是默认有高亮的. 测试有没有代码高亮(eclipse代码): package p_day1; public class ...
- 7-4 List Leaves (25分) JAVA
Given a tree, you are supposed to list all the leaves in the order of top down, and left to right. I ...
- SSTI-服务端模板注入漏洞
原理: 服务端模板注入是由于服务端接收了用户的输入,将其作为 Web 应用模板内容的一部分,在进行目标编译渲染的过程中,执行了用户插入的恶意内容,因而导致了敏感信息泄露.代码执行.GetShell ...
- zookeeper 伪集群安装和 zkui管理UI配置
#=======================[VM机器,二进制安装] # 安装环境# OS System = Linux CNT7XZKPD02 4.4.190-1.el7.elrepo.x86_ ...
- Nginx 从入门到放弃(一)
Nginx nginx的使用场景 静态资源服务 通过本地文件系统提供服务 反向代理服务 nginx的强大性能 缓存 负载均衡 API服务 OpenResty nginx优点 高并发.高性能 可扩展性好 ...
- python-循环-两种方法实现九九乘法表
方法一:用最基本的while循环嵌套(基础时,便于理解) while循环的嵌套,先执行里边的,再执行外边的 i = 1 while i <= 9: j = 1 while j <= i: ...
- mongodb安装与mongo vue的使用
首先,下载mongodb,然后安装 http://downloads.mongodb.com/win32/mongodb-win32-x86_64-enterprise-windows-64-2.6. ...
- MySQL 快速删除大量数据(千万级别)的几种实践方案
笔者最近工作中遇见一个性能瓶颈问题,MySQL表,每天大概新增776万条记录,存储周期为7天,超过7天的数据需要在新增记录前老化.连续运行9天以后,删除一天的数据大概需要3个半小时(环境:128G, ...
- abp一代数据迁解析
abp版本5.9 概述 数据迁移无非就是两件事情,1.创建数据库,并根据实体创建对应的表:2.添加一些初始数据 abp的数据迁移也是完成这两件事,比较特殊的是它是多租户saas系统,而且支持不同的租户 ...