Beavel Posted December 10, 2011 Report Share Posted December 10, 2011 I have batch script set to run wget to download an application, but I can't get it to trigger on change. I've tried leaving in a value for the URL field, but it errors out. I've removed all data from the URL field and it now updates the version properly, but doesn't trigger the batch script to run. I know the batch script works as I can go into Edit-> Commands Tab -> Run and it downloads the file. I thought from reading the wiki that an external program could be used to download an application, but I'm not clear on how to get the command to trigger. Can someone help clarify how and when those commands are trigger? Thanks, Beavel *Sidenote: I went to wget because the application I am downloading requires a cookie to download, and needed to save and load it through wget. Link to comment Share on other sites More sharing options...
shawn Posted December 13, 2011 Report Share Posted December 13, 2011 The pre-update scripts are what the "exit 2" functionality is for. There's a recent thread on that here. You can set cookies in Ketarin using the httpx protocol, too. Link to comment Share on other sites More sharing options...
Beavel Posted February 21, 2012 Author Report Share Posted February 21, 2012 I'm just getting back to this issue as the application I need it for has updated, and the command did not run. I'm still not clear on when my batch script should trigger and run. I have an empty URL field which Ketarin complains about when I save the application. The warning Ketarin provides states that this application won't be downloaded, which I think is my problem. However, if I put anything in the URL field, Ketarin fails to detect a version change and complains it can't download the file because it is not of a binary file type. What should be placed in the Download Sources URL field so that the batch script runs, and Ketarin doesn't complain about the file not being binary? Below is my script in case there is something problematic with it, but it seems to work fine when I manually run it. start "" /wait wget --content-disposition --spider --save-cookies="{cookiesFile}" {downloadURL} start "" /wait wget --content-disposition --output-document="{appdir}{outputFilename}" --load-cookies="{cookiesFile}" {downloadURL} exit 3 Link to comment Share on other sites More sharing options...
shawn Posted February 21, 2012 Report Share Posted February 21, 2012 Put anything in the download box if you're using an external downloader. Can you share your app profile so I can see how these variables are assigned? Link to comment Share on other sites More sharing options...
Beavel Posted March 3, 2012 Author Report Share Posted March 3, 2012 Well... this topic has become academic for me now. The site has updated in the last two weeks so cookies are no longer needed and I can reference the download directly. With that said, I'm still interested in why it wasn't working. When I tried putting a valid URL in, Ketarin would throws an error that the file doesn't exist. If I put in an invalid URL it would throw an error that the URL isn't valid. I'm using Ketarin 1.6.0.434. Here is my app profile if it helps: <?xml version='1.0' encoding='utf-8'?> <Jobs> <ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Guid="c340a239-ccd3-42fc-aadc-5b1bde938291"> <WebsiteUrl /> <UserAgent /> <UserNotes /> <LastFileSize>666540</LastFileSize> <LastFileDate>2011-08-20T09:26:14.46045</LastFileDate> <IgnoreFileInformation>false</IgnoreFileInformation> <DownloadBeta>Default</DownloadBeta> <DownloadDate xsi:nil="true" /> <CheckForUpdatesOnly>false</CheckForUpdatesOnly> <VariableChangeIndicator>version</VariableChangeIndicator> <CanBeShared>true</CanBeShared> <ShareApplication>false</ShareApplication> <ExclusiveDownload>false</ExclusiveDownload> <HttpReferer /> <SetupInstructions /> <Variables> <item> <key> <string>version</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>RegularExpression</VariableType> <Regex>(?<=<A HREF).*?((\d[.]){1,3}\d+)(?></A>)</Regex> <Url>http://hashcat.net/hashcat/</Url> <Name>version</Name> </UrlVariable> </value> </item> <item> <key> <string>cookiesFile</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>{appdir}cookies.txt</TextualContent> <Name>cookiesFile</Name> </UrlVariable> </value> </item> <item> <key> <string>downloadURL</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>http://hashcat.net/files/download.php?proj={appname}</TextualContent> <Name>downloadURL</Name> </UrlVariable> </value> </item> <item> <key> <string>appdir</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>{archive}\Hashcat\{appname}\</TextualContent> <Name>appdir</Name> </UrlVariable> </value> </item> <item> <key> <string>outputFilename</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>{appname}-{version}.7z</TextualContent> <Name>outputFilename</Name> </UrlVariable> </value> </item> </Variables> <ExecuteCommand /> <ExecutePreCommand>REM start "" /wait start "" /wait wget --content-disposition --spider --save-cookies="{cookiesFile}" {downloadURL} start "" /wait wget --content-disposition --output-document="{appdir}{outputFilename}" --load-cookies="{cookiesFile}" {downloadURL} exit 3</ExecutePreCommand> <ExecuteCommandType>Batch</ExecuteCommandType> <ExecutePreCommandType>Batch</ExecutePreCommandType> <Category>InfoSec</Category> <SourceType>FixedUrl</SourceType> <PreviousLocation>F:\Archive\Hashcat\hashcat\hashcat-0.37.7z</PreviousLocation> <DeletePreviousFile>false</DeletePreviousFile> <Enabled>true</Enabled> <FileHippoId /> <LastUpdated>2011-08-20T09:26:14.46045</LastUpdated> <TargetPath>{archive}\Hashcat\{appname}\</TargetPath> <FixedDownloadUrl>{downloadURL}</FixedDownloadUrl> <Name>hashcat</Name> </ApplicationJob> </Jobs> Another interesting thing is that when I updated the URL to be correct for the new site, my script fired, downloaded the file, and then Ketarin downloaded it right after. It seems that it ignored the exit 3. Link to comment Share on other sites More sharing options...
shawn Posted March 3, 2012 Report Share Posted March 3, 2012 Your {downloadURL} variable is likely the problem. Hitting that in a browser pushes a redirect. Instead, you can build a direct download link ( http://hashcat.net{downloadURL} ) based on the version with this: HREF="([^"]*?)">v{version} That gets the direct download link for the file of the same version you're actually tagging it with. Link to comment Share on other sites More sharing options...
GaronneBC Posted April 14, 2015 Report Share Posted April 14, 2015 Putting some text in the download url field doesn't work for me at all. For debugging I added a plain echo xxxx >T:\x.txt into the pre-update commands section. Guess what? No x.txt file is generated. The commands (including wget and exit) just aren't triggered at all. Link to comment Share on other sites More sharing options...
necrox Posted April 14, 2015 Report Share Posted April 14, 2015 echo xxxx >T:\x.txt into the pre-update commands section. Guess what? No x.txt file is generated. The commands (including wget and exit) just aren't triggered at all. This should work: echo xxxx >> D:\x.txt Regarding your command set (wget/exit/etc) please add some more details. Link to comment Share on other sites More sharing options...
GaronneBC Posted April 15, 2015 Report Share Posted April 15, 2015 Ok, changed: echo TEST {preupdate-url} >> T:\xx.txt "\PortableApps\WinWGetPortable\App\winwget\wget\wget.exe" "http://www.acetext.com/cgi-bin/download" -P "\Downloads" -c --post-data="lang=en&app=act&email={email}&id={id}" --output-document=\Installer\JGSoft\{file:filename} && exit 3 exit 2 Just for completeness sake... Ok, the WGet download parameters are working perfectly, as I tried them using WGet / WinWGet manually and the download succeded perfectly. Email and id were replaced by me because they are my license data I need to submit. They are plain text within Ketarin though variables should work, too. No text file xx.txt is generated on calling update or force update. Maybe because Ketarin still for some reason thinks the (not existing aka deleted) file I downloaded earlier is still valid and current. EDIT: Actually I wouldn't mind if you cross check my main thread about my download problem: (Link) Neither setting a fake download uri nor leaving it empty helps. Setting or removing my update variable doesn't help either. Not even faking a new version number (aka setting a text variable as update variable and adding a plain text string faking a new version number). Link to comment Share on other sites More sharing options...
shawn Posted May 26, 2021 Report Share Posted May 26, 2021 I know this is years late, but I was looking for something else and saw that one of the issues in this wasn't addressed. The problem with your troubleshooting line is most likely that you didn't quote the URL. This means that your script will crash before it actually echoes anything to the file if there's an ampersand (&) or certain other characters in the {preupdate-url} variable. Try this instead: echo TEST "{preupdate-url}" >> T:\xx.txt Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now