How to do JMeter ip spoofing on Mac? - macos

Just try to figure out how to do ip spoofing in JMeter on my mac. What is done is that I created file which contains ip addresses somewhere in my subnetwork.
When I try to run thread JMeter shows me:
java.net.BindException: Can't assign requested address
Only my IP has ping. So, could you please advice me where I am wrong?

You can add an IP alias from Terminal application (it is under Applications -> Utilities) as
sudo ifconfig en0 alias 192.168.0.12 255.255.255.0
where:
en - is Network Interface name
192.168.0.12 - is the IP alias
Once you set up the alias, you can use new IP address in the "Source address" input
And HTTP requests will use that IP address as source one:
You can remove the IP alias when it is no longer required as
sudo ifconfig en0 -alias 192.168.0.12
See Using IP Spoofing to Simulate Requests from Different IP Addresses with JMeter guide for more detailed information on the domain.

Related

How to go from geth in WSL to vEthernet adaptor to Router

On my windows 10 pro laptop I am running geth in WSL. The problem is I can not seem to get reach my wireless router. I am getting a status of not connected to my router. So the web3J calls returns a can not connect. I setup my geth:
geth --http.port "8545" --http.addr "192.168.1.15" --datadir test-chain-dir --http --dev
I setup eth0 to match my address in my ipv4 settings config in my vethernet adaptor
ifconfig eth0 192.168.1.15 and the mask ifconfig eth0 netmask 255.255.255.0
I also add a route ip route add default via 192.168.1.15
So what am I doing wrong? I also tried adding on the windows side the command to setup portproxy.
Is there some definitive instructions somewhere about setting up geth to work within WSL and able to reach out to the router? I wrote some simple code using web3j running on a android phone that is connected on my local network.
Thanks!

certbot cannot verify domain and connection refused

I am trying to generate certificate for my domain. I can ping my domain but still getting error. I have added inbound firewall rule to my digital ocean server to accept port 80 on ipv4 and ipv6 as well. Not sure what is wrong. [Note: my nginx server is not running as I cannot get the certificate]
https://community.letsencrypt.org/t/invalid-response-404-nginx-docker-container/102525
My domain is: www.1040nra.com
I ran this command: sudo certbot certonly --staging --webroot -w /root/dt-app-data/ -d 1040nra.com -d www.1040nra.com
It produced this output:
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for 1040nra.com
http-01 challenge for www.1040nra.com
Using the webroot path /root/dt-app-data for all unmatched domains.
Waiting for verification…
Cleaning up challenges
Failed authorization procedure. 1040nra.com (http-01): urn:ietf:params:acme:error:connection :: The server could not connect to the client to verify the domain :: Fetching http://1040nra.com/.well-known/acme-challenge/22AD-KFmF62z373CPiUKzk6dlr-0s5wMOmnmrziMqd4: Connection refused, www.1040nra.com (http-01): urn:ietf:params:acme:error:connection :: The server could not connect to the client to verify the domain :: Fetching http://www.1040nra.com/.well-known/acme-challenge/ba-jjDhBUZJ9fHLofGfDYSVV5a-ETlX26A64A-2Yu0s: Connection refused
IMPORTANT NOTES:
The following errors were reported by the server:
Domain: 1040nra.com
Type: connection
Detail: Fetching
http://1040nra.com/.well-known/acme-challenge/22AD-KFmF62z373CPiUKzk6dlr-0s5wMOmnmrziMqd4:
Connection refused
Domain: www.1040nra.com
Type: connection
Detail: Fetching
http://www.1040nra.com/.well-known/acme-challenge/ba-jjDhBUZJ9fHLofGfDYSVV5a-ETlX26A64A-2Yu0s:
Connection refused
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A/AAAA record(s) for that domain
contain(s) the right IP address. Additionally, please check that
your computer has a publicly routable IP address and that no
firewalls are preventing the server from communicating with the
client. If you’re using the webroot plugin, you should also verify
that you are serving files from the webroot path you provided.
My web server is (include version):
The operating system my web server runs on is (include version): ubuntu 18.04
You seem to have solved the problem yourself.
This is because the certbot domain cannot verify the DNS A record.
Make sure your domain address is directed to your server's ip address.
If you made the dns change 'recently', it may take some time to delete the old ip address.
https://www.whatsmydns.net/
Check here, there should only be one IP address and this should be your server's IP address.
Make sure ports 80 and 443 are open by running the command below:
sudo ufw status
If port 443 is not open, then run the command bellow to allow port 443:
sudo ufw allow https
Issue: The issue is your domain might be not pointing to your Cloud host IP and DNS setup
Solution:
You have to map your domain and IP in-network option tab A
Once you did the mapping then you have to setup DNS on where you have purchased the domain website.
Then check by entering your domain name on this web site www.whatsmydns.net showing your IP address or not
If Yes then you create the certificate
Go to the https://www.whatsmydns.net/
Enter your host name
You set the type A
Make sure that there is the same IP everywhere
You set the type AAAA
Make sure there are no AAAA entries
AAAA are IPv6 entries.
If the addresses for AAAA are present, make a request to this IPv6 address
#example curl [43ff:0c89:eb10:4c06:c90e:4b7d:64e5:fbe1]
curl [your IPv6]
If you get an error, then the address does not point to your site. Accordingly, there is a difference between IPv4 and IPv6.
Solution: delete the domain zone type AAAA

Boot2Docker: Connect to container over LAN

I'm using Boot2Docker 1.3.0 on my Mac and I'm pretty happy so far using it. But now I'd like to connect to a http container (exposes port 8080) not from my local machine but from another machine in my local network? If I'm doing it locally I just use http://192.168.59.103:8080 so I'm using the ip address of the docker host. This can't work for other machines in my local network but using the ip address of my mac does not work either. I'm pretty sure there are some solutions for this problem but I can't find any. It can't be that hard right? What I want is to make a request to http://[IP-Address-of-mac]:8080 from another host in my local network. I think I have to set up some routing rules on my local machine right? May anybody tell me what to do? Thanks in advance.
Best regards
Sascha
You need to port forward from the OSX box to the virtual machine
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port8080,tcp,,8080,,8080";
should do the trick
or, you could use ssh based port forwarding:
boot2docker ssh -L 8000:localhost:8000
see https://github.com/boot2docker/boot2docker/blob/master/doc/WORKAROUNDS.md
On your Mac, determine the IP address that it uses on your local LAN:
$ ifconfig | grep 192
inet 192.168.1.21 netmask 0xffffff00 broadcast 192.168.1.255
inet 192.168.59.3 netmask 0xffffff00 broadcast 192.168.59.255
Then port forward:
$ boot2docker ssh -vnNTL 192.168.1.21:8080:localhost:8080
Now, requests that come into your Mac on port 8080 will get forwarded to the boot2docker Linux VM on port 8080. The docker server will then forward from the exposed port (VM port 8080) to the port your container is using for httpd (probably 80).
Note that "localhost" above is from the point of view of the Linux VM, not the Mac, because that is the host you are ssh'ing into.

Assign static local ip address to OS inside virtual machine with bridged connection

I have win 7 OS on my laptop, and linux(debian 7) inside vmware. I have set the debian to have bridged connection with the network. I am connected by wifi, and if the wifi modem is being restarted the local ip address of the debian changes, e.g. from 192.168.0.106 to 192.168.0.102. Is there a way to set the local ip address, so it will always remain the same ?
Thanks
You have to change your /etc/network/interfaces like this
and after that remember to restart your service using
sudo service networking restart
ok, found the solution
here is the source
http://www.cyberciti.biz/tips/howto-ubuntu-linux-convert-dhcp-network-configuration-to-static-ip-configuration.html
basically for debian
1) vim /etc/network/interfaces
2) comment/delete this line iface eth0 inet dhcp
3) add this
iface eth0 inet static
address 192.168.1.106 # this is the ip address you want to assign
netmask 255.255.255.0
network 192.168.1.0

Using port number in Windows host file

After installing TeamViewer, I have changed the wampserver port to 8080, so the address is http://localhost:8080.
For the host file located at C:\WINDOWS\system32\drivers\etc\, I have also made the change as below
BEFORE
127.0.0.1 www.example.com
AFTER
127.0.0.1:8080 www.example.com
When I access www.example.com, it doesn't redirect to my wampserver, how can I fix it?
I managed to achieve this by using Windows included Networking tool netsh.
As Mat points out : The hosts file is for host name resolution only, so a combination of the two did the trick for me.
Example
Overview
example.app:80
| <--Link by Hosts File
+--> 127.65.43.21:80
| <--Link by netsh Utility
+--> localhost:8081
Actions
Started my server on localhost:8081
Added my "local DNS" in the hosts file as a new line
127.65.43.21 example.app
Any free address in the network 127.0.0.0/8 (127.x.x.x) can be used.
Note: I am assuming 127.65.43.21:80 is not occupied by another service.
You can check with netstat -a -n -p TCP | grep "LISTENING"
added the following network configuration with netsh command utility
netsh interface portproxy add v4tov4 listenport=80 listenaddress=127.65.43.21 connectport=8081 connectaddress=127.0.0.1
I can now access the server at http://example.app
Notes:
- These commands/file modifications need to be executed with Admin rights
- netsh portproxy needs ipv6 libraries even only to use v4tov4, typically they will also be included by default, otherwise install them using the following command: netsh interface ipv6 install
You can see the entry you have added with the command:
netsh interface portproxy show v4tov4
You can remove the entry with the following command:
netsh interface portproxy delete v4tov4 listenport=80 listenaddress=127.65.43.21
Links to Resources:
Using Netsh
Netsh commands for Interface IP
Netsh commands for Interface Portproxy
Windows Port Forwarding Example
The hosts file is for host name resolution only (on Windows as well as on Unix-like systems). You cannot put port numbers in there, and there is no way to do what you want with generic OS-level configuration - the browser is what selects the port to choose.
So use bookmarks or something like that.
(Some firewall/routing software might allow outbound port redirection, but that doesn't really sound like an appealing option for this.)
What you want can be achieved by modifying the hosts file through Fiddler 2 application.
Follow these steps:
Install Fiddler2
Navigate to Fiddler2 menu:- Tools > HOSTS.. (Click to select)
Add a line like this:-
localhost:8080 www.mydomainname.com
Save the file & then checkout www.mydomainname.com in browser.
Fiddler2 -> Rules -> Custom Rules
then find function OnBeforeRequest on put in the next script at the end:
if (oSession.HostnameIs("mysite.com")){
oSession.host="localhost:39901";
oSession.hostname="mysite.com";
}
The simplest way is using Ergo as your reverse proxy:
https://github.com/cristianoliveira/ergo
You set your services and its IP:PORT and ergo routes it for you :).
You can achieve the same using nginx or apache but you will need to configure them.
This doesn't give the requested result exactly, however, for what I was doing, I was not fussed with adding the port into the URL within a browser.
I added the domain name to the hosts file
127.0.0.1 example.com
Ran my HTTP server from the domain name on port 8080
php -S example.com:8080
Then accessed the website through port 8080
http://example.com:8080
Just wanted to share in case anyone else is in a similar situation.
If what is happening is that you have another server running on localhost and you want to give this new server a different local hostname like
http://teamviewer/
I think that what you are actually looking for is Virtual Hosts functionality. I use Apache so I do not know how other web daemons support this. Maybe it is called Alias. Here is the Apache documentation:
Apache Virtual Hosts examples
-You can use any free address in the network 127.0.0.0/8 , in my case needed this for python flask and this is what I have done :
add this line in the hosts file (you can find it is windows under : C:\Windows\System32\drivers\etc ) :
127.0.0.5 flask.dev
Make sure the port is the default port "80" in my case this is what in the python flask: app.run("127.0.0.5","80")
now run your code and browse flask.dev
Using netsh with connectaddress=127.0.0.1 did not work for me.
Despite looking everywhere on the internet I could not find the solution which solved this for me, which was to use connectaddress=127.x.x.x (i.e. any 127. ipv4 address, just not 127.0.0.1) as this appears to link back to localhost just the same but without the restriction, so that the loopback works in netsh.
You need NGNIX or Apache HTTP server as a proxy server for forwarding http requests to appropriate application -> which listens particular port (or do it with CNAME which provides Hosting company). It is most powerful solution and this is just a really easy way to keep adding new subdomains, or to add new domains automatically when DNS records are pointed at the server.
Apache era call it Virtual host ->
httpd.apache.org/docs/trunk/vhosts/examples.html
NGINX -> Server Block
https://www.nginx.com/resources/wiki/start/topics/examples/server_blocks/
Alternate way
Install Redirector
Click Edit redirects -> Create New Redirect

Resources