Jump to content

jmurch

Members
  • Posts

    82
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

jmurch's Achievements

Member

Member (2/5)

0

Reputation

  1. I am reading a stream using '$input = trim(fread($socket, 16384));' and everything is working fine until the length of data from the stream exceeds 4078. At 4078 I stop for some reason reading the stream. I am wondering why this works (up to 4078): '$input = trim(fread($socket, 16384));' But this does not: '$input = stream_get_contents($socket);' Other parameters for the stream are: stream_set_blocking($con, true); stream_socket_enable_crypto($con, true, STREAM_CRYPTO_METHOD_TLS_SERVER); handle_incoming_connection($con, $client); $res = stream_context_create($streamopts); if ($res === false) { System_Daemon::err('error when creating stream'); System_Daemon::stop(); exit(1); } $master = stream_socket_server( "tcp://$host:$port", $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $res ); if ($master === false) { System_Daemon::err('stream_socket_server(): [%s] %s', $errno, $errstr ); System_Daemon::stop(); exit(1); } stream_socket_enable_crypto($master, false); function handle_incoming_connection($socket, $client) { $input = trim(fread($socket, 16384)); if (($input == null) || ($input == 'exit') ) { return; } Any help would be greatly appreciated. TIA, Jeff
  2. I want to explode on \n but not for data within double quotes: currently: explode("\n",$decoded_data); Does anyone have any pointers on how to do this? TIA, Jeff
  3. Thanks guys......................!!!!
  4. I'm rying to find a PHP function that will split a binary file to an fixed length chunk into an array other than just using the linux 'split' functionality. 'explode' would work but I need a fixed length chunk not using a delimeter. TIA, Jeff
  5. As the title says, my script won't continue after the exec when running from a cron (running cron job as root). Tried a bang, 744 etc. no luck. Works fine from cli. Anyone have any suggestions? TIA, Jeff
  6. More missing details: This rule matches this ssh log entry: Log entry: Aug 4 20:59:16 socketserver sshd[21442]: Failed password for root from 98.165.54.217 port 56595 ssh2 Rule: ^%(__prefix_line)sFailed (?:password|publickey) for .* from <HOST>(?: port \d*)?(?: ssh\d*)?$ (Note that this is for use in the iptables module fail2ban. The entry __prefix_line comes from another config file but I figured that leaving it out would be more confusing) This rule does not match this log entry: Log entry: [Aug 04 14:22:02] err: bad or missing CDL header. refused connection from 98.165.54.217:54335 [l:980] Rule: /bad or missing CDL header\. refused connection from ([0-9.:]+)/ Thanks!
  7. Yes your correct I want to capture the log entry less the port info after the ip when it contains 'err: bad or missing CDL header. refused connection from' Thanks
  8. Probably my mistake for not explaining better. I need to match only entries that do contain the string: 'err: bad or missing CDL header. refused connection from' Since there are other log entries. Jeff
  9. I am trying to come up with a regex that will match this log entry: [Aug 04 14:22:02] err: bad or missing CDL header. refused connection from 98.165.54.217:54335 [l:980] Where timestamp and ip address will obviousley be different each time. I dont care about anything after the colon in the ip address. TIA, Jeff
  10. I am configuring fail2ban so that it will capture a log input similar to this: err: bad or missing CDL header refused connect from 98.165.54.217:65174 [l:949] The regex that I have that's not working is this: failregex = err: bad or missing TDL header refused connect from \S+ \(<HOST>\)\s*$ I just want the host address not the full string with the port number. I don't know if fail2ban syntax is different than normal regex syntax. TIA, Jeff
  11. I'm hoping someone has run into this before. I am using the pear system_daemon to run some cli code as a daemon. In Debian it runs great but won't start the daemon in RHEL. TIA, Jeff
  12. I am trying to work around something and need to add and subtract one second to the times. I'm using the format: $now = date("Y-m-d H:i:s"); I need to ultimatley have the results such as: $now = (date("Y-m-d H:i:s") - :01); or $now = (date("Y-m-d H:i:s") + :01); TIA, Jeff
  13. Solved! $r_lines = explode(',',$r); $i = 0; while ($i <= sizeof($r_lines)) { $r_lines_string = $r_lines[$i]; $r_detail = explode('~',$r_lines_string); echo "<pre>"; print_r($r_detail); echo "</pre>"; $i++; }
  14. Getting closer: $r_lines = explode(',',$r); $i = 0; while ($i <= sizeof($r_lines)) { $r_lines_string = implode('~',$r_lines); $r_detail = explode('~',$r_lines_string); echo "<pre>"; print_r($r_detail); echo "</pre>"; $i++; echo "var i = ".$i; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.