Jump to content

Lock Remote IP in Domain


Ario.Paxaz

Recommended Posts

 

also look at the ServerModule for property BlockedIPList

 

I use it,but when a user 3 time Mistakes in login credentials I block its IP,But all domain computers are locked.

I want recognize Which computer in  domain caused this mistake,and lock it.

Notice that I use my Web application On internet.

Link to comment
Share on other sites

I pick up the local network IP, to exclude other machines from accessing cash register functions,

than the one having the physical connection to the receipt printer/cash drawer.

 

Notice the double backslash in the regex.

window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
var pc = new RTCPeerConnection({iceServers:[]}), noop = function(){};      
pc.createDataChannel('');
pc.createOffer(pc.setLocalDescription.bind(pc), noop);
pc.onicecandidate = function(ice)
{
  if (ice && ice.candidate && ice.candidate.candidate)
  {
    var myIP = /([0-9]{1,3}(\\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/.exec(ice.candidate.candidate)[1];
    ajaxRequest(MainForm.mainFrame, ['getLocalIP'], { IP : myIP });
    pc.onicecandidate = noop;
  }
};
Link to comment
Share on other sites

It is Javascript, and you can load it from a textfile and assign it

to a uniHtmlFrame and then pick up the response in the AjaxEvent of the frame.

 

You can also inject the JS code at runtime, using the AddJS function (not tested):

uniSession.AddJS('window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;');
uniSession.AddJS('var pc = new RTCPeerConnection({iceServers:[]}), noop = function(){}; ');
uniSession.AddJS('pc.createDataChannel(""); ');
uniSession.AddJS('pc.createOffer(pc.setLocalDescription.bind(pc), noop);');
uniSession.AddJS('pc.onicecandidate = function(ice){ ');
uniSession.AddJS('if (ice && ice.candidate && ice.candidate.candidate) { ');
uniSession.AddJS('var myIP = /([0-9]{1,3}(\\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/.exec(ice.candidate.candidate)[1];');
uniSession.AddJS('ajaxRequest(MainForm.mainFrame, ["getLocalIP"], { IP : myIP }); ');
uniSession.AddJS('pc.onicecandidate = noop;  }}; ');

And then in the AjaxEvent:

procedure TMainForm.mainFrameAjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);  

begin
  if eventname='getLocalIP' then 
  begin
    uniMainModule.localIP:=Params.Values['IP'];
    
  end;

Farshad: Would it be an idea to integrate this webRTC function into the mainmodule, so we can have the local IP as a client connects?

Link to comment
Share on other sites

  • 1 year later...
  • 4 weeks later...
On 4/29/2020 at 6:06 PM, Freeman35 said:

Hi,

How to fix regex format?

problem is not on regex format.

https://stackoverflow.com/questions/56543917/unable-to-fetch-ip-v4-address-from-rtcpeerconnection-chrome
 

Quote

 

EDIT (Mar 2020): it looks like Firefox could be anonymizing local IPs as well.

As of March 2020, there are two settings in about:config page:

  • media.peerconnection.ice.obfuscate_host_addresses - when set to true, it changes local IP to {uuid}.local
  • media.peerconnection.ice.obfuscate_host_addresses.whitelist - string with URLs, which are able to retrieve real IP, even with obfuscation enabled

I've checked Firefox 73 and Developer Edition 74 (without any extension that could have changed the setting), first had obfuscate_host_addresses set to false, while dev edition had it enabled.

 

MacOS & Win10x64 firefox work with this settings.

on macOS, opera & safari not work.

not tested chrome any os.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...