Jump to content


Photo

Lock Remote IP in Domain

remote IP Lock

  • Please log in to reply
9 replies to this topic

#1 A.Soltani

A.Soltani

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 157 posts
  • LocationTehran-Iran

Posted 11 July 2018 - 11:02 AM

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.


  • 0

#2 Mohammed Nasman

Mohammed Nasman

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 184 posts
  • LocationGaza - Palestine

Posted 11 July 2018 - 11:57 AM

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)?


  • 0

#3 A.Soltani

A.Soltani

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 157 posts
  • LocationTehran-Iran

Posted 11 July 2018 - 12:26 PM

I want lock its IP that  computer don't  execute my web application.

I want to get access to that computer from the application.


  • 0

#4 Mohammed Nasman

Mohammed Nasman

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 184 posts
  • LocationGaza - Palestine

Posted 11 July 2018 - 12:53 PM

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;

  • 0

#5 Mohammed Nasman

Mohammed Nasman

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 184 posts
  • LocationGaza - Palestine

Posted 11 July 2018 - 12:55 PM

also look at the ServerModule for property BlockedIPList


  • 0

#6 A.Soltani

A.Soltani

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 157 posts
  • LocationTehran-Iran

Posted 11 July 2018 - 11:14 PM

 

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.


  • 0

#7 delphidude

delphidude

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 202 posts
  • LocationNorway

Posted 14 July 2018 - 07:09 AM

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;
  }
};

  • 0

#8 A.Soltani

A.Soltani

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 157 posts
  • LocationTehran-Iran

Posted 14 July 2018 - 12:57 PM

 

 

window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;

Hi

 

This code is in C or Java?


  • 0

#9 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 5177 posts

Posted 14 July 2018 - 01:18 PM

Hi
 
This code is in C or Java?


https://webrtc.org
  • 0

#10 delphidude

delphidude

    Advanced Member

  • uniGUI Subscriber
  • PipPipPipPip
  • 202 posts
  • LocationNorway

Posted 15 July 2018 - 11:12 AM

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?


  • 0





Also tagged with one or more of these keywords: remote IP, Lock

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users