JS + cmd + curl + socks5 + EVAL === syntax issue

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

JS + cmd + curl + socks5 + EVAL === syntax issue

by JonnyDee on Mon May 11, 2015 8:50 am

Hi all!

Hope this is not a duplicate .. started previously and post suddenly disappeared

CONFIG: imacros browser 10.0.2, IE11, Windows 7

Preamble: trying to find (my) best way to use a socks5 service I subscribed to with imacros

Testing: tried various tools like privoxy and pipolio (among others) but each lacked something useful(for me) :!: :?:

Basic Code: using the cmd shell I found this very workable (Socks5 listed is a public IP for my test) :idea:

Code: Select all
I:\public_html>curl -x, --proxy SOCKS5://66.239.62.153:10323 geoip.hidemyass.com:80


gives me the output I expected and verified that the proxy was working

Code: Select all
<html>
<head>
<link rel="icon" href="favicon.ico" type="image/x-icon">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>[b]162.243.163.141[/b]</title>

<img src="http://aws.hidemyass.com/flags_iso/128/us.png" align=absmiddle> [b]162.24
3.163.141[/b][b][/b]</span>
<table>
<tr>
<td>ISP:</td>
<td>Digital Ocean</td>
</tr>
<tr>
<td>Country:</td>
<td><img src="http://aws.hidemyass.com/flags_iso/16/us.png" align=absmiddle>[b]Unit
ed States[/b]</td>
</tr>
<tr>
<td>State/Region:</td>
<td>[b]NY[/b]</td>
</tr><tr>
<td>City:</td>
<td>[b]New York[/b]</td>
</tr><tr>
<td>Postal code:</td>
<td>[b]10118[/b]</td>
</tr><tr>
<td>Area code:</td>
<td>[b]212[/b]</td>
</tr></table>
</div>


Problem: every attempt at using the EVAL only produces another syntax error. Based on the EVAL Command page, this is the best I was able to compute
Code: Select all
SET !VAR1 EVAL (var x = ("I:\\public_html\\cmd.exe"; "curl -x, --proxy SOCKS5://66.239.62.153:10323 geoip.hidemyass.com:80"); x;)
'if needed >>
URL GOTO= {{!VAR1}}

Help from syntax gurus greatfully acknowledged!
Jonny

ps NO guarantee that the public SOCKS5 will continue to work: Ill test out all suggestions myself

UPDATE:

I tried the demo code here: http://wiki.imacros.net/URL#Using_Javascript

Code: Select all
 URL GOTO=http://www.iopus.com
 URL GOTO=javascript:openDemo('shared/flash/imacros1',820,650);
 TAB T=2


and it works correctly, but every version of my own based on that code I have no success

'testsocks5.iim

Code: Select all
    VERSION BUILD=10022823
    TAB T=1
    TAB CLOSEALLOTHERS
SET !ENCRYPTION NO   
CLEAR
SET !ERRORIGNORE NO
SET !EXTRACT_TEST_POPUP NO
URL GOTO=google.ca
URL GOTO=bing.com

'
' -------------------start = no syntax errors reported -----the 5 code samples that didnt have syntax problems------

Code: Select all
PROXY ADDRESS=curl,<SP>-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port;<SP>example.com;
'PROXY ADDRESS=curl,<SP>-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port,<SP>example.com;
'PROXY ADDRESS=curl,<SP>-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port<SP>example.com;

' ----same error reported on all three--------------^^^^^^^-----& no errors reported on syntax
' (does not go to example.com)

returns PROMPT is empty
&& then(instead of example.com) I have "The proxy server isn’t responding •Check your proxy settings curl(-x:80. Go to Tools > Internet Options > Connections. If you are on a LAN, click “LAN settings”.•Make sure your firewall settings aren’t blocking your web access.•Ask your system administrator for help.
' ===============================
Code: Select all
'PROXY ADDRESS=curl,<SP>-x,<SP>--proxy<SP>SOCKS5:/'PROXY ADDRESS=curl(-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port; /ValidSocks5IP:port;

' ----same error reported on both--------------^^^^^^^-----& no errors reported on syntax
' (does not go to example.com)

returns PROMPT is empty
&& then(instead of example.com) I have "The proxy server isn’t responding •Check your proxy settings curl(-x:80. Go to Tools > Internet Options > Connections. If you are on a LAN, click “LAN settings”.•Make sure your firewall settings aren’t blocking your web access.•Ask your system administrator for help.
'
' ---------------------------------ends no syntax errors reported -----------
Code: Select all
PAUSE
PROMPT {{GOTO}}
URL GOTO=example.com:80
PAUSE


I have tried following code----- start here -- syntax errors & imacros halts -----------

Code: Select all
'URL GOTO=curl,<SP>-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port<SP>example.com; 'Your search - curl, -x, --proxy SOCKS5://ValidSocks5IP:port example.com; - did not match any documents.
'PROXY ADDRESS=curl -x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port;  'Wrong format of PROXY ADDRESS
'PROXY ADDRESS=curl(-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port);  'Wrong format of PROXY ADDRESS
'PROXY ADDRESS=curl(-x, --proxy SOCKS5://ValidSocks5IP:port; 'Wrong format of PROXY ADDRESS
'PROXY ADDRESS=curl(-x, --proxy SOCKS5://ValidSocks5IP:port) 'Wrong format of PROXY ADDRESS
'PROXY ADDRESS=curl(-x, --proxy SOCKS5:\/\/ValidSocks5IP:port) 'Wrong format of PROXY ADDRESS
'PROXY ADDRESS=curl(-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port)   ' no error but doesnt go to proxy
'PROXY ADDRESS=curl -x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port  'Error -1100: Wrong format of PROXY ADDRESS
'URL GOTO=javascript:open(bing.com); ' doesnt open bing && returns PROMPT is empty && then opens 'example.com' properly
'URL GOTO=javascript:open("curl,bing.com"); ''The webpage cannot be displayed
'URL GOTO=javascript:open("curl<SP>-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port,example.com"); ' returns '[object Window]'
'PROXY ADDRESS=javascript:open.curl("-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port"); 'returns PROMPT is empty && then opens 'example.com' properly
'PROXY ADDRESS=javascript:open.curl("-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port");  'same web page displayed at the PAUSE && then after PAUSE =The webpage cannot be displayed
'PROXY ADDRESS=javascript:curl("-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port"); 'same web page displayed at the PAUSE && then after PAUSE =The webpage cannot be displayed
'PROXY ADDRESS=javascript:open("curl<SP>-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port"); 'The webpage cannot be displayed
'URL GOTO=javascript:open 'curl("-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port")';
'URL GOTO=javascript:open("curl<SP>-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port"); ' returns '[object Window]'
'URL GOTO=javascript:start("curl<SP>-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port");
'URL GOTO=javascript:run("curl<SP>-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port");
'URL GOTO=javascript:curl("-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port");
'URL GOTO=javascript:("curl<SP>-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port"); example.com:80");
'URL GOTO= javascript:openDemo(curl<SP>-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port example.com:80);
'URL GOTO= javascript:curl ('-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port example.com:80');
'URL GOTO= javascript:curl ('-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port example.com');
'URL GOTO= javascript:curl '-x,<SP>--proxy<SP>SOCKS5://ValidSocks5IP:port example.com';
'URL GOTO= javascript:curl ("-x, --proxy SOCKS5://ValidSocks5IP:port example.com");
'URL GOTO= javascript:curl "-x, --proxy SOCKS5://ValidSocks5IP:port example.com";
'URL GOTO= javascript:curl ("-x, --proxy SOCKS5://ValidSocks5IP:port example.com:80")
'URL GOTO= javascript:curl ("-x, --proxy SOCKS5://ValidSocks5IP:port example.com")
JonnyDee
 
Posts: 17
Joined: Tue Jun 10, 2014 9:51 am

Re: JS + cmd + curl + socks5 + EVAL === syntax issue

by chivracq on Tue May 12, 2015 2:40 pm

Foufff, complex Question..., but OK, my 2 cts as I use 'EVAL()' extensively and your Syntax looks wrong to me indeed...:
Code: Select all
SET !VAR1 EVAL (var x = ("I:\\public_html\\cmd.exe"; "curl -x, --proxy SOCKS5://66.239.62.153:10323 geoip.hidemyass.com:80"); x;)
'if needed >>
URL GOTO= {{!VAR1}}

I would rather use stg like this:
Code: Select all
SET !VAR1 EVAL("var x='I:\\public_html\\cmd.exe; curl -x, --proxy SOCKS5://66.239.62.153:10323 geoip.hidemyass.com:80'; x;")
'if needed >>
URL GOTO= {{!VAR1}}

And the Syntax to open a Local File is:
Code: Select all
URL GOTO=file:///D:/TEMP/iMacros/Current/iMacros/Downloads/Temp.html
=> With Forward Slashes, so you may have to use:
Code: Select all
SET !VAR1 EVAL("var x='I:/public_html/cmd.exe; curl -x, --proxy SOCKS5://66.239.62.153:10323 geoip.hidemyass.com:80'; x;")
'if needed >>
URL GOTO=file:///{{!VAR1}}

But 'cmd.exe' is an .EXE, and I think that since FF14, the Browser prevents running Executable Files from JavaScript.
A Workaround could be to use a Windows Shortcut on 'cmd.exe' with all your Parameters, then use the FF Add-on 'External Application Buttons' with a Button on this 'cmd.exe' Shortcut, with a Shortcut for that Button and call that Button by its Shortcut using the EVENT Mode. It's pretty cumbersome but it works normally, I had tested it maybe some 2 years ago, even if I tried again for some recent Thread a few weeks ago to get it to work again, but I didn't really succeed anymore, but I didn't spend much-much time on the Problem...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6471
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: JS + cmd + curl + socks5 + EVAL === syntax issue

by JonnyDee on Wed May 20, 2015 2:47 pm

@ by chivracq on Tue May 12, 2015 5:40 pm

TYVM for the input ... no happiness with suggestions offered

For me, it looks that I will be running everything from .bat files :roll: (for this project) to have a more robust solution. :shock:

Be well,
Jonny
JonnyDee
 
Posts: 17
Joined: Tue Jun 10, 2014 9:51 am


Return to Scripting and Command Line Interface

Who is online

Users browsing this forum: No registered users and 4 guests

-->