Skip to content

HercControl sometimes misses "</PRE>" in syslog results #4

@RossPatterson

Description

@RossPatterson

HerControl doesn't always properly recognize end of syslog data, because </PRE> doesn't necessarily start at the start of a line. Hercules writes it this way:

hprintf(webblk->sock, "</PRE>\n");

so if it happens to start at the start of the line, that's just luck. We should change the code in callHerculesConsole(string, int , vector<string>) to look for it at the end of the line, not the beginning.

Here is an example of the failure. Note the line timestamped "2025-10-09T21:44:35.1881020Z":

2025-10-09T21:44:33.0640983Z Ready; T=0.01/0.01 21:44:33
2025-10-09T21:44:33.0645907Z + herccontrol /EXPLOIT (BRXTESTS) DISK DUMP &FN &FT F -w ^Ready;
2025-10-09T21:44:35.1867481Z ERROR: Failed to Remark output
2025-10-09T21:44:35.1868340Z /(0009) EXPLOIT (BRXTESTS) DISK DUMP &amp;�FN &amp;�FT F
2025-10-09T21:44:35.1868874Z CMD IS DISK DUMP ABBREV1 EXEC F
... 65 lines omitted ...
2025-10-09T21:44:35.1879938Z CMD IS DISK DUMP CMSEPL_ EXEC F
2025-10-09T21:44:35.1880308Z FILE 'CMSEPL_ EXEC F' NOT FOUND.
2025-10-09T21:44:35.1880655Z CMD IS DISK DUMP CMSEXCM ASSEMBLE F
2025-10-09T21:44:35.1881020Z CMD IS DIS</PRE>
2025-10-09T21:44:35.1881347Z <FORM method=post>Command:
2025-10-09T21:44:35.1881731Z <INPUT type=text name=command size=80 autofocus>
2025-10-09T21:44:35.1882164Z <INPUT type=submit name=send value="Send">
2025-10-09T21:44:35.1882625Z <INPUT type=hidden name=norefresh value=1>
2025-10-09T21:44:35.1882985Z <INPUT type=hidden name=refresh_interval value=5>
2025-10-09T21:44:35.1883334Z <INPUT type=hidden name=msgcount value=80>
2025-10-09T21:44:35.1883739Z </FORM>
2025-10-09T21:44:35.1883912Z <BR>
2025-10-09T21:44:35.1884188Z <A name=bottom>
2025-10-09T21:44:35.1884649Z <FORM method=post>
2025-10-09T21:44:35.1885081Z <INPUT type=submit value="Auto Refresh" name=autorefresh>
2025-10-09T21:44:35.1885837Z Refresh Interval: <INPUT type=text name="refresh_interval" size=2 value=5>
2025-10-09T21:44:35.1886412Z <INPUT type=hidden name=msgcount value=80>
2025-10-09T21:44:35.1886822Z </FORM>
2025-10-09T21:44:35.1887101Z <FORM method=post>
2025-10-09T21:44:35.1887646Z Only show last <INPUT type=text name=msgcount size=3 value=80> lines (zero for all loglines)
2025-10-09T21:44:35.1888375Z <INPUT type=hidden name=norefresh value=1>
2025-10-09T21:44:35.1888890Z <INPUT type=hidden name=refresh_interval value=5>
2025-10-09T21:44:35.1889302Z </FORM>
2025-10-09T21:44:35.1889554Z </body>
2025-10-09T21:44:35.1889802Z </html>
2025-10-09T21:44:35.1985572Z ##[error]Process completed with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions