Jump to content
uniGUI Discussion Forums
A.Soltani

Lock Remote IP in Domain

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

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

Share this post


Link to post
Share on other sites

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;

Share this post


Link to post
Share on other sites

 

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.

Share this post


Link to post
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;
  }
};

Share this post


Link to post
Share on other sites

 

 

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

Hi

 

This code is in C or Java?

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×