Get IP address in cakephp 3.2 - cakephp-3.x

Here i want to find the ip address of system,which i want to implement.
but i stucked here.
I am using cakephp version 3.2.
i have worked on it
,getting an incomplete ip ::1,while my machine ip is 155.0.0.1
Below is code
for getting ip
echo $this->request->clientIp();//getting output ::1
use Cake\Network\Request;
Here i have requested for client ip .
In above controller i have used use Cake\Network\Request;
I am not very sure about it.
Please suggest me.
Where i am doing wrong.
will highly appreciate.

Related

HTTPS ESP8266WebServerSecure: how to get a client's IP address?

I have a ESP8266 HTTPS server (ESP8266WebServerSecure, core v. 3.0.2).
It works just fine but I cannot get a remote client's IP address the same way as with the plain unsecure ESP8266WebServer. The method server.client().remoteIP().toString() just returns "(IP unset)".
Please help to resolve.
It turned to be a bug in the ESP8266 core libraries. See the fix.

Bash-Ubuntu 18.04-ROS-Melodic: Ping to IP address does not return anything

I have a Velodyne Puck 16 sensor that I have been trying to connect to ROS Melodic for the past few days. My OS is Ubuntu 18.04. I was able to find out the address of the lidar using WireShark, as it is possible to see below:
So the IP is: 10.0.1.201
After very very carefully following the installation procedure in the official documentation everything I was trying was unsuccessful.
So I decided to apply a simple ping procedure to the address of the lidar:
ping 10.0.1.201 it does not return any package of information despite it seems connected.
The problem I have is that, despite I know the IP address of my Velodyne 16 using Wireshark, the lidar does not answer to a simple test as the ping of the id.
Steps I followed:
1 Configure your computer’s IP
Below the connection procedure: I created a velodyne_interface connection, see below:
Existing Connection
velodyne_interface
2 Connecting your computer to LIDAR through terminal
emanuele#pc:~$ sudo ifconfig enp109s0 192.168.3.100
Add a static route to the LIDAR's IP address.
emanuele#pc:~$ sudo route add 10.0.1.201 enp109s0
3 Checking the configurations [Problem is here]
To check the connection open your web browser and access the following sensor’s network address.
The problem is that I never get to see the webpage showing the lidar data. Basically I never get to see the page below provided in the official documentation:
What is happening? Why is that happening?
There is probably some problems with the routing. You can try debugging the routing issues, some googling will probably help there. Some commands which might help pinpoint the problem tracepath -n 10.0.1.201 and ip route list.
The easiest solution to your problem would be to just configure the "velodyne_interface" you created to the same subnet as your velodyne lidar. So in the "velodyne_interface" set your ip to 10.0.1.20 for example. Connect to the "velodyne_interface" connection, verify that you have the ip you set by typing ip a or ifconfig in some terminal and you should be able to access the Velodyne web interface from 10.0.1.201. From there you can configure the velodyne sensor networking to the settings you like.

How do I set up my computer to serve website using web2py?

I've got web2py working so I can access my webapp from my computer locally. I also have tornado working and listening on port 8080 as I want to use websockets.
I've chosen the "Public (0.0.0.0)" option when firing up the server and listening on port 8000.
I've set up port forwarding on my router from port 80 to port 8000 using the "other" function of the guide p.58.
When typing "what is my ip" it seems to be an IPv6 IP so no idea if that matters but I tried to check if I've done it correctly by going to this site http://www.ipv6proxy.net/index.php and trying to navigate to my IP address that google spit out when I typed "what is my ip?" but get a couldn't connect to the host message.
Any idea what I'm doing wrong?
I'm relatively new to this.
To explain motivation I simply want to do a dry run of the website and websockets online. I think there are a tonne of security risks associated with what I'm doing and this is simply a learning exercise for me and do not intend to host the website this way. I do want to understand how I would do this though.
EDIT
I'm running ubuntu 14.04 LTS

Recaptcha IP addresses

Okay, so we implement Recaptcha in production. We get errors because it can't reach the IP address it needs to use the service. We open a port for the IP address to reach Google. No problem. We do that and configure that IP address explicitly to work. It works great. Then, the next day, we start getting errors again because Recaptcha is using a different IP address. I can allow requests from that IP address, too, but now I'm unsettled. Where are these addresses coming from? How do I configure this to work reliably?
Recatpcha from Google can use any Google IP address and there are lots of them.
Ran this from Windows:
_netblocks.google.com text =
nslookup -type=TXT _netblocks.google.com
"v=spf1 ip4:216.239.32.0/19 ip4:64.233.160.0/19 ip4:66.249.80.0/20 ip4:72.14.192.0/18 ip4:209.85.128.0/17 ip4:66.102.0.0/20 ip4:74.125.0.0/16 ip4:64.18.0.0/20 ip4:207.126.144.0/20 ip4:173.194.0.0/16 ?all"
That's all the network Google uses currently. These can change so check them often.
Google suggest allowing port 80 to all IPs outbound, this highly insecure. They recommend going through a proxy server but again that is highly insecure if your web server is an DMZ. Proxy aware trojans do exist. All that need to be done is exploit a vulnerability to execute arbitrary code and you can create reverse connection on port 80 through a proxy server to download the payload. Then it is trivial to escalate privileges and own the box. I don't mean just Windows servers but Linux as well. I've done it in lab environment on security was on. It's really easy to do.
This is the Google website I got this from:
http://code.google.com/p/recaptcha/wiki/FirewallsAndRecaptcha
I wanted to append to this answer with more recent information. The documentation that Chris is pointing to does not include all of the TXT records necessary to dig (thanks Google):
_netblocks2.google.com (IPv6 subnets)
_netblocks3.google.com (Additional IPv4 subnets)
In my particular case, the _netblocks3 entry contained 2 large /19's that made my initial rule ineffective
(I found additional references here: https://support.google.com/a/answer/60764?hl=en)
Perhaps you should be using a hostname rather than IP

Mac-os-x how to get network details like ip-address, subnet mask,etc

I am new to Mac-OS-X development. I want to get the users Network details just for displaying it in my application. Details such as the IP address, Subnet mask, status whether connected or not, etc.
Is it possible to get the same??
And secondly, Is the IP address different for wireless lan connections and the normal ethernet connections?? I am a little weak at networking concepts.
Any help will be appreciated.
note: I already tried searching the apple developer site for leads but wat i could find is only the System Configuration Programming guide
Strange.. There are no Frameworks or classes to get the IP address... But i somehow managed to get my hands on the following information.. First with this reference.. And secondly i found that..
As mentioned in the link, If we manually set the IP, then it gets stored in the preferences.plist.
But if we set the IP to DCHP, then we can get the ConfigMethod as "DCHP" and hence check the com.apple.network.identification.plist, it'll have the details for the IP address.
Hence with the use of both the plist and checking whether the ConfigMethod is "Manual" or "DCHP" we can get the current IP address albeit this is not documented anywhere.

Resources