Ario.Paxaz Posted July 11, 2018 Posted July 11, 2018 Hi How to can lock IP of user in remote IP that Its computer located in domain,that domain have a valid IP. When I lock a IP ,all computer that locate in domain (valid IP) are locked. Best Regards. Quote
Mohammed Nasman Posted July 11, 2018 Posted July 11, 2018 Do you mean you want to lock an IP from not use your unigui application? or do you want to lock computer by IP (lock windows screen)? Quote
Ario.Paxaz Posted July 11, 2018 Author Posted July 11, 2018 I want lock its IP that computer don't execute my web application. I want to get access to that computer from the application. Quote
Mohammed Nasman Posted July 11, 2018 Posted July 11, 2018 On MainModule add Create evens as following: procedure TMM.UniGUIMainModuleCreate(Sender: TObject); var ip:string; begin ip := unisession.RemoteIP; if ip = '192.1.1.1' then UniSession.Terminate('Not allowed'); end; Quote
Mohammed Nasman Posted July 11, 2018 Posted July 11, 2018 also look at the ServerModule for property BlockedIPList Quote
Ario.Paxaz Posted July 11, 2018 Author Posted July 11, 2018 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. Quote
Ron Posted July 14, 2018 Posted July 14, 2018 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; } }; Quote
Ario.Paxaz Posted July 14, 2018 Author Posted July 14, 2018 window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection; Hi This code is in C or Java? Quote
Sherzod Posted July 14, 2018 Posted July 14, 2018 Hi This code is in C or Java? https://webrtc.org Quote
Ron Posted July 15, 2018 Posted July 15, 2018 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? Quote
Freeman35 Posted May 28, 2020 Posted May 28, 2020 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.