Jmeter:IP欺骗无效 [英] Jmeter: IP spoofing not working

查看:587
本文介绍了Jmeter:IP欺骗无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要测试IP欺骗,请执行以下步骤:

To test IP Spoofing I am following below steps:

  1. 打开CMD并执行nslookup www.xyz.com.asdfg-staging.net
  2. 这将提供IP地址,并将此IP地址添加到hosts文件的底部.此处C:\Windows\System32\drivers\etc
  3. 打开Jmeter并将此IP添加到Http Sample中,如下所示:
  1. Open CMD and do nslookup www.xyz.com.asdfg-staging.net
  2. This will give the IP address , add this IP address at the bottom of hosts file.Here C:\Windows\System32\drivers\etc
  3. Open Jmeter and add this IP in Http Sample as shown below:

如链接中所述如何在jmeter中设置IP欺骗?发送具有多个IP地址的请求apache-JMeter(IP欺骗)访问我的应用程序 4.运行测试,我在View Results Tree侦听器中只看到红色错误,但是我没有执行步骤3,那么只有绿色.

As instrcuted in links How to setup IP spoofing in jmeter? and send requests with multiple ip address to my application using apache-JMeter(IP Spoofing) 4. Run the tests and I only see red errors in View Results Tree listener but I do not follows step #3 then there are only greens.

我期望的是欺骗IP",即我在主机文件中添加的IP地址应该出现在View Results Tree侦听器的Request标签中.

What I am expecting is "spoofed IP" i.e. the IP adress that I added in host file should be present in Request tab of View Results Tree listener.

我在这里做错了什么?上面共享的教程还要求编辑IPv4属性,实现我想要的功能真的是强制性的吗?

What am I doing wrong here? The tutorials that shared above also asked to edit IPv4 properties , is that really mandatory to achieve what I am looking for?

推荐答案

对客户端地址进行IP欺骗.在您的屏幕快照中,您尝试在HOST标头中查找欺骗IP的值,该标头通常指向实际的服务器主机名而不是IP.

IP Spoofing is done for the client side addresses. In your screenshot, you are trying to find the value of the spoofed IP in the HOST header which usually points to the actual server hostname and not the IP.

方案1,未对IPv4字段分配任何值,并且针对myhost.test.com进行了测试

Scenario 1 with no values assigned in IPv4 field with test done against myhost.test.com

Request Headers:
Connection: close
Content-Type: application/json
Content-Length: 162
Host: myhost.test.com
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_111)

方案2的源地址"字段设置为10.1.153.90

Scenario 2 with Source Address field set to 10.1.153.90

Request Headers:
Connection: close
Content-Type: application/json
Content-Length: 162
Host: myhost.test.com
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_111)
**X-LocalAddress: /10.1.153.90**

在我看来,您似乎正在尝试将服务器IP欺骗为服务提供商提供的特定IP,以便仅使用Akamai登台环境.在这种情况下,使用为服务器(而非客户端)分配的IP设置C:\ Windows \ System32 \ drivers \ etc \ hosts文件将在JMeter外部进行,并由OS(而非JMeter)处理.

To me, it looks like you are trying to spoof your server IP to a specific IP provided by the service provider so that you hit only that like Akamai staging environment. In that case, setting your C:\Windows\System32\drivers\etc\hosts file with the assigned IP for your server (not the client) will work outside JMeter and is handled by the OS (not JMeter).

1.54.163.146 myhost.test.com

在操作系统级别,您的操作系统将负责将针对myhost.test.com的请求发送到您在C:\ Windows \ System32 \ drivers \ etc \ hosts文件中提供的IP上

At the OS level, your OS will take care of sending requests addressed for myhost.test.com to the IP that you gave above in C:\Windows\System32\drivers\etc\hosts file

要查看实际的IP地址,请添加一个预处理器(beanshell或等效的容器)并添加以下几行

To see the actual IP address, add a pre-processor (beanshell or equivalent) and add the below lines

import java.net.InetAddress;

InetAddress address = InetAddress.getByName("myhost.test.com"); 
log.info("Address=" + address.getHostAddress()); 

如果要测量此IP地址占用的请求时间,可以将其放在变量中,并将其添加到采样器名称中

If you want to measure your request time taken by this IP addresses, you can put it in a variable and add that in your sampler name

import java.net.InetAddress;

InetAddress address = InetAddress.getByName("myhost.test.com"); 
log.info("Address=" + address.getHostAddress()); 
vars.put("addressused",  address.getHostAddress()); 

然后将$ {addressused}附加到您的采样器名称.它将根据samplername + ipaddress来衡量交易

Then append ${addressused} to your samplername. It will measure the transaction based on samplername+ipaddress

这篇关于Jmeter:IP欺骗无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆