Community discussions

MikroTik App
 
ambrosemtk
just joined
Topic Author
Posts: 20
Joined: Tue Sep 05, 2017 12:29 pm
Location: Uganda
Contact:

Layer7-protocol over API(java)

Mon Jul 02, 2018 3:35 pm

Hi guys any one know what i am missing!!
I am using Gideons Java library and i want to add a layer7-protocol regex with the following command
con.execute("/ip/firewall/layer7-protocol/add name=test regexp=\"^(\\\\x13bittorrent protocol|azver\\\\x01\\$|get /scrape\\\\\\?info_hash=get /announce\\\\\\?info_hash=|get /client/bitcomet/|GET data\\\\\\?fid=)|d1:ad2:id20:|\\\\x08'7P\\\\)[RP]\"");
And i keep getting:
Exception in thread "main" me.legrange.mikrotik.MikrotikApiException: failure: bad regexp: unmatched ()..


Thanks in advance
 
ambrosemtk
just joined
Topic Author
Posts: 20
Joined: Tue Sep 05, 2017 12:29 pm
Location: Uganda
Contact:

Re: Layer7-protocol over API(java)

Thu Jul 05, 2018 3:25 pm

Guys please give me some ideas here, was able to solve the unknown parameter error by putting the value of the regular expression in quotes
as shown:
String regexp="\"^(\\\\x13bittorrent protocol|azver\\\\x01\\$|get /scrape\\\\\\?info_hash=get /announce\\\\\\?info_hash=|get /client/bitcomet/|GET /data\\\\\\?fid=)|d1:ad2:id20:|\\\\x08'7P\\\\)[RP]\"";
con.execute("/ip/firewall/layer7-protocol/add name=pol regexp="+regexp+"");
This fails with failure: bad regexp: unmatched ()
Any help !!!!

Who is online

Users browsing this forum: m4rk3J and 76 guests