is there a command to detect the actual ip that is using tor when connected to tor via telnet?
I mean like sending "getinfo circuit-status" or "signal newnym" commands
Thanks!
"getinfo address" will tell you what tor believes your current external IP address to be. It sounds like you might be interested in what the final hop of an arbitrary circuit is. You can figure this out from your "getinfo circuit-status" query by looking up the IP of the last router in the path.
So, if one of the circuits lists its path as $000000000000000000000000000,$111111111111111111111111111,$222222222222222222222222222 then you may issue another query "getinfo ns/id/222222222222222222222222222" to determine the IP of that last router.
This is the second question I've seen about getting the IP of your present exit relays. It's an interesting question so I've added a FAQ entry for it - hope this helps!
Related
I am trying to implement a monitoring system using ONOS. I am able to collect the port delta statistics from them using port_stat_changed listener.
In the flow statistics, I get the flow entry, which has selection criterion. This criterion only has only Ethernet information. Is there any way to identify the Source and Destination IP address and Port using ONOS. Any suggestion would be very helpful.
The source and destination IP and MAC if they are not in the Switch's rules can be accessed by the application by taking this information from the packets. If your application does not have access to the packages, I do not think the Switches store this kind of information. In case, then, you're going to have to develop a solution by putting a rule in the Switch to pick up that data.
This probably has a very obvious answer, but what is the common way to get the router/gateway IP address of the packet I just received in pcap.net?
I know how to get the IP address source:
packet.Ethernet.IpV4.Source.ToString()
I tried looking through the object browser, but I didn't find a property that seemed to match. Any way I could find it?
It's more of networking question, than programming one. A short answer would be - You can't.
The source IP address will always (unless strangely translated by the gateway) belong to the endpoint You wanted to connect with. This way Your application will get the response to any request You send. Unless You're using NAT the router does not alter the packet in any way so it's transparent from a connectivity point of view. The source address of the packet You just got would almost always contain the IP address of the server You connected to. That's the way Ethernet works.
A poor man's solution would be to use traceroute to find out which way the packets go and therefore get the address of the router, which generally would be the first hop along the way. From a programmer's perspective this would mean sending out several packets to the destination You got the packet from, each time incrementing the packet's TTL (starting from 1) and looking at the ICMP responses. This however could mislead You if some sort of load balancing is being done.
Maybe if You clarified what You would like to achieve I could point You in a better direction.
Hi friends. I am developing an application in which I am returning the IP address for a particular system and saving it in a database. When I check the database it is showing the server ip address. I want get the particular ip address who is running that application.
So far I have this code:
Public Function GetIPAddress() As String
Dim strHostName As String = System.Net.Dns.GetHostName()
Dim strHostName1 As String = System.Net.Dns.GetHostName()
Dim ipHostInfo As System.Net.IPHostEntry = System.Net.Dns.Resolve(System.Net.Dns.GetHostName())
Dim ipAddress As System.Net.IPAddress = ipHostInfo.AddressList(0)
Return ipAddress.ToString()
End Function
Keep in mind that a machine may have multiple IP addresses pointing to it, so this isn't really possible. Well, not in theory anyway - in practice, you may be able to hack something together.
That's undoubtedly because your code is running on the server itself, not the client. Hence, when you ask for the IP address, it faithfully gives it to you.
Any solution running on the server (such as examining the source IP address of the TCP session) has to keep in mind that, with firewalls and network address translation and all the other wonderful features of networking that protect us from the baddies, the address you get may bear little resemblance to the actual IP address of the client machine.
You need to get code running on the client machine that can basically do the same thing. And keep in mind there that a client may have many IP addresses allocated to it.
On my desktop machine alone, I have two physical NICs, each with two addresses and multiple virtual NICs for VPNs and VMWare images. Granted, my desktop box is not your ordinary home PC, but it's not out of the realms of possibility for a box to have two addresses.
And, in fact, a single machine can quite easily change its IP address if on DHCP and it decides to release the lease on its address and get another one.
All in all, the IP address is not a very reliable indicator of which machine is doing things. Perhaps if you step back and give us more details on what you're trying to achieve, we can help further.
Use the code below to get the ip of the client system.
string host=System.Net.Dns.GetHostName();
string ip = System.Net.Dns.GetHostByName(host).AddressList[0].ToString();
Here the ip address give the client ip address.
Perhaps this would help? - https://stackoverflow.com/a/23824592/2647808
It looks like the best way to do it is with System.Net.Dns.GetHostName(). You can then extract either the IPv4 address or IPv6 address with a For loop and If statement. Hope that helps.
I'm developing small demo application for Windows Mobile 6.1 to get the list of all serial ports and the Bluetooth devices configured on them. I'm facing some weird problem.
I can see total 10 COM ports when I go to Settings->Connections->Bluetooth->COM POrts. But when I use SerialPort.GetPortNames() to get all the ports, it shows 9 ports i.e. one port less. The last port i.e. COM09 is not returned in the result set.
Then I removed one of the paired devices configured on one of the COM ports (COM08) and SerialPort.GetPortNames() returned the result set WITHOUT the COM08 port.
I further tried to know which COM ports are still unused. When i tried to create "New Outgoing Port" manually on one of the 'unused' (as per my program) port, it gives a message saying "COM port cannot be created"!
Could someone tell me the reason and guide me further to resolve the issue?
The Bluetootch driver is probably modifying the registry key where the Drivers are and GetPortNames is probably looking through that key.
Take a look at both HKLM\Drivers\BuiltIn and HKLM\Drivers\Active with the remove registry editor and see what's happening. You can likely write your own parser that looks at these values for what you are after.
I'm trying to find my external IP address, but I get local ones only, behind the NAT.
NSArray *addresses = [[NSHost currentHost] addresses];
Is there a way to print out the public address? Using NSHost is it a good idea?
There may not always be a reliable way to get at your public IP, but the DNSService API in OS X will use UPnP and/or the NAT port mapping protocol to get the public IP (amongst other things). The code illustrating how to use the C API would be a bit large (50-60 lines) to show here, but there's some Apple sample code which implements a nice ObjC wrapper around the functionality, and even offers a pair of functions to directly return UInt32 and NSString representations of the public IP address.
The relevant code itself is located here, but you're probably best off just downloading the zip file and including PortMapper.h and PortMapper.m in your project and using them directly. Then all you'd need to do is:
NSString * publicAddressString = [PortMapper findPublicAddress];
If you ever get to look at a network topology chart for a major organization, do so. It's enlightening. The whole point of NAT, firewalls and all that other "black magic" is to allow the network to manage addresses (including protecting you) without your knowledge.
There are only three ways in which I've been able to reliably (and reliable is a relative concept here) get the external-facing IP address of a server.
The first is to as the network gods themselves (and make sure you refer to them as gods when asking, this will assist you in getting the information). Sometimes (not always), it's a simple mapping of the top bytes of your IP address whilst retaining the low-order bytes. Sometimes it's more complex, but still follows rules that you can use. Just keep in mind these rules can change at any time.
The second is to have a box outside of your network which you can query and it, in turn, can let you know your IP address.
The third is to specifically attach to an outside DNS server (not your corporate one) to retrieve the information.
Of course, you should question the need to know your external IP address. The whole point of DNS is to avoid having to worry too much about IP addresses and just refer to machines by the domain names.
There is no reliable way to get your public IP. Depending on your network topology, you may not be able to depend on the outgoing address for a number of reasons: IP address pools, dynamic routes, multiple layers of NAT, proxy servers, etc.