According to http://peachfuzzer.com/PingMonitor, Linux needs some
changes to work. Here is a patch to make this change. I'm not sure
what your commit criteria is, so let me know if I need to do something
different.
Cheers,
Chris M.
Index: Peach/Agent/network.py
===================================================================
--- Peach/Agent/network.py (revision 1882)
+++ Peach/Agent/network.py (working copy)
@@ -93,22 +93,42 @@
'''
Check if a fault was detected.
'''
- pipe = os.popen("ping -n 2 " + self.hostname)
- buff = pipe.read()
- pipe.close()
-
- if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
bytes=", re.M).search(buff) != None:
- return False
-
- # If we didn't see a ping, lets try again with 3 pings
just to make sure
-
- pipe = os.popen("ping -n 3 " + self.hostname)
- buff = pipe.read()
- pipe.close()
-
- if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
bytes=", re.M).search(buff) != None:
- return False
-
+ if sys.platform == "win32":
+ pipe = os.popen("ping -n 2 " + self.hostname)
+ buff = pipe.read()
+ pipe.close()
+
+ if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
bytes=", re.M).search(buff) != None:
+ return False
+
+ # If we didn't see a ping, lets try again with
3 pings just to make sure
+
+ pipe = os.popen("ping -n 3 " + self.hostname)
+ buff = pipe.read()
+ pipe.close()
+
+ if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
bytes=", re.M).search(buff) != None:
+ return False
+
+ elif sys.platform == "linux2":
+ pipe = os.popen("ping -c 2 " + self.hostname)
+ buff = pipe.read()
+ pipe.close()
+
+ if re.compile(r"64 bytes from \d+\.\d+\.\d+\.\d
+:", re.M).search(buff) != None:
+ return False
+
+ # If we didn't see a ping, lets try again with
3 pings just to make sure
+
+ pipe = os.popen("ping -c 3 " + self.hostname)
+ buff = pipe.read()
+ pipe.close()
+
+ if re.compile(r"64 bytes from \d+\.\d+\.\d+\.\d
+:", re.M).search(buff) != None:
+ return False
+ else:
+ raise RuntimeError("PingMonitor running on
unsupported platform %s" % sys.platform)
+
return True
> According tohttp://peachfuzzer.com/PingMonitor, Linux needs some
> changes to work. Here is a patch to make this change. I'm not sure
> what your commit criteria is, so let me know if I need to do something
> different.
> Cheers,
> Chris M.
> Index: Peach/Agent/network.py
> ===================================================================
> --- Peach/Agent/network.py (revision 1882)
> +++ Peach/Agent/network.py (working copy)
> @@ -93,22 +93,42 @@
> '''
> Check if a fault was detected.
> '''
> - pipe = os.popen("ping -n 2 " + self.hostname)
> - buff = pipe.read()
> - pipe.close()
> -
> - if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
> bytes=", re.M).search(buff) != None:
> - return False
> -
> - # If we didn't see a ping, lets try again with 3 pings
> just to make sure
> -
> - pipe = os.popen("ping -n 3 " + self.hostname)
> - buff = pipe.read()
> - pipe.close()
> -
> - if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
> bytes=", re.M).search(buff) != None:
> - return False
> -
> + if sys.platform == "win32":
> + pipe = os.popen("ping -n 2 " + self.hostname)
> + buff = pipe.read()
> + pipe.close()
> +
> + if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
> bytes=", re.M).search(buff) != None:
> + return False
> +
> + # If we didn't see a ping, lets try again with
> 3 pings just to make sure
> +
> + pipe = os.popen("ping -n 3 " + self.hostname)
> + buff = pipe.read()
> + pipe.close()
> +
> + if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
> bytes=", re.M).search(buff) != None:
> + return False
> +
> + elif sys.platform == "linux2":
> + pipe = os.popen("ping -c 2 " + self.hostname)
> + buff = pipe.read()
> + pipe.close()
> +
> + if re.compile(r"64 bytes from \d+\.\d+\.\d+\.\d
> +:", re.M).search(buff) != None:
> + return False
> +
> + # If we didn't see a ping, lets try again with
> 3 pings just to make sure
> +
> + pipe = os.popen("ping -c 3 " + self.hostname)
> + buff = pipe.read()
> + pipe.close()
> +
> + if re.compile(r"64 bytes from \d+\.\d+\.\d+\.\d
> +:", re.M).search(buff) != None:
> + return False
> + else:
> + raise RuntimeError("PingMonitor running on
> unsupported platform %s" % sys.platform)
> +
> return True
> - if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
> bytes=", re.M).search(buff) != None:
> + if re.compile(ping_reply_regex, re.M).search(buff) !=
> None:
> return False
> return True
> On Oct 23, 4:02 pm, "ChrisM." <cm.mc...@gmail.com> wrote:
>> Hi,
>> According tohttp://peachfuzzer.com/PingMonitor, Linux needs some
>> changes to work. Here is a patch to make this change. I'm not sure
>> what your commit criteria is, so let me know if I need to do something
>> different.
>> Cheers,
>> Chris M.
>> Index: Peach/Agent/network.py
>> ===================================================================
>> --- Peach/Agent/network.py (revision 1882)
>> +++ Peach/Agent/network.py (working copy)
>> @@ -93,22 +93,42 @@
>> '''
>> Check if a fault was detected.
>> '''
>> - pipe = os.popen("ping -n 2 " + self.hostname)
>> - buff = pipe.read()
>> - pipe.close()
>> -
>> - if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
>> bytes=", re.M).search(buff) != None:
>> - return False
>> -
>> - # If we didn't see a ping, lets try again with 3 pings
>> just to make sure
>> -
>> - pipe = os.popen("ping -n 3 " + self.hostname)
>> - buff = pipe.read()
>> - pipe.close()
>> -
>> - if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
>> bytes=", re.M).search(buff) != None:
>> - return False
>> -
>> + if sys.platform == "win32":
>> + pipe = os.popen("ping -n 2 " + self.hostname)
>> + buff = pipe.read()
>> + pipe.close()
>> +
>> + if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
>> bytes=", re.M).search(buff) != None:
>> + return False
>> +
>> + # If we didn't see a ping, lets try again with
>> 3 pings just to make sure
>> +
>> + pipe = os.popen("ping -n 3 " + self.hostname)
>> + buff = pipe.read()
>> + pipe.close()
>> +
>> + if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
>> bytes=", re.M).search(buff) != None:
>> + return False
>> +
>> + elif sys.platform == "linux2":
>> + pipe = os.popen("ping -c 2 " + self.hostname)
>> + buff = pipe.read()
>> + pipe.close()
>> +
>> + if re.compile(r"64 bytes from \d+\.\d+\.\d+\.\d
>> +:", re.M).search(buff) != None:
>> + return False
>> +
>> + # If we didn't see a ping, lets try again with
>> 3 pings just to make sure
>> +
>> + pipe = os.popen("ping -c 3 " + self.hostname)
>> + buff = pipe.read()
>> + pipe.close()
>> +
>> + if re.compile(r"64 bytes from \d+\.\d+\.\d+\.\d
>> +:", re.M).search(buff) != None:
>> + return False
>> + else:
>> + raise RuntimeError("PingMonitor running on
>> unsupported platform %s" % sys.platform)
>> +
>> return True
> > - if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
> > bytes=", re.M).search(buff) != None:
> > + if re.compile(ping_reply_regex, re.M).search(buff) !=
> > None:
> > return False
> > return True
> > On Oct 23, 4:02 pm, "ChrisM." <cm.mc...@gmail.com> wrote:
> >> Hi,
> >> According tohttp://peachfuzzer.com/PingMonitor, Linux needs some
> >> changes to work. Here is a patch to make this change. I'm not sure
> >> what your commit criteria is, so let me know if I need to do something
> >> different.
> >> Cheers,
> >> Chris M.
> >> Index: Peach/Agent/network.py
> >> ===================================================================
> >> --- Peach/Agent/network.py (revision 1882)
> >> +++ Peach/Agent/network.py (working copy)
> >> @@ -93,22 +93,42 @@
> >> '''
> >> Check if a fault was detected.
> >> '''
> >> - pipe = os.popen("ping -n 2 " + self.hostname)
> >> - buff = pipe.read()
> >> - pipe.close()
> >> -
> >> - if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
> >> bytes=", re.M).search(buff) != None:
> >> - return False
> >> -
> >> - # If we didn't see a ping, lets try again with 3 pings
> >> just to make sure
> >> -
> >> - pipe = os.popen("ping -n 3 " + self.hostname)
> >> - buff = pipe.read()
> >> - pipe.close()
> >> -
> >> - if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
> >> bytes=", re.M).search(buff) != None:
> >> - return False
> >> -
> >> + if sys.platform == "win32":
> >> + pipe = os.popen("ping -n 2 " + self.hostname)
> >> + buff = pipe.read()
> >> + pipe.close()
> >> +
> >> + if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
> >> bytes=", re.M).search(buff) != None:
> >> + return False
> >> +
> >> + # If we didn't see a ping, lets try again with
> >> 3 pings just to make sure
> >> +
> >> + pipe = os.popen("ping -n 3 " + self.hostname)
> >> + buff = pipe.read()
> >> + pipe.close()
> >> +
> >> + if re.compile(r"Reply from \d+\.\d+\.\d+\.\d+:
> >> bytes=", re.M).search(buff) != None:
> >> + return False
> >> +
> >> + elif sys.platform == "linux2":
> >> + pipe = os.popen("ping -c 2 " + self.hostname)
> >> + buff = pipe.read()
> >> + pipe.close()
> >> +
> >> + if re.compile(r"64 bytes from \d+\.\d+\.\d+\.\d
> >> +:", re.M).search(buff) != None:
> >> + return False
> >> +
> >> + # If we didn't see a ping, lets try again with
> >> 3 pings just to make sure
> >> +
> >> + pipe = os.popen("ping -c 3 " + self.hostname)
> >> + buff = pipe.read()
> >> + pipe.close()
> >> +
> >> + if re.compile(r"64 bytes from \d+\.\d+\.\d+\.\d
> >> +:", re.M).search(buff) != None:
> >> + return False
> >> + else:
> >> + raise RuntimeError("PingMonitor running on
> >> unsupported platform %s" % sys.platform)
> >> +
> >> return True