aboutsummaryrefslogtreecommitdiffstats
path: root/simpleton.py
diff options
context:
space:
mode:
authorFilipp Lepalaan <f@0x00.co>2012-12-19 09:53:03 +0200
committerFilipp Lepalaan <f@0x00.co>2012-12-19 09:53:03 +0200
commitdca858dd87d262f665dd5625f17e31b0c9710088 (patch)
tree4d8418ce20deec8860202ffde0254dacd678c714 /simpleton.py
parent6b1c810664f5e40f1595cdbca37215373438fb0a (diff)
downloadsimpleton-dca858dd87d262f665dd5625f17e31b0c9710088.tar.gz
simpleton-dca858dd87d262f665dd5625f17e31b0c9710088.tar.bz2
simpleton-dca858dd87d262f665dd5625f17e31b0c9710088.zip
Second commit
Diffstat (limited to 'simpleton.py')
-rwxr-xr-xsimpleton.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/simpleton.py b/simpleton.py
new file mode 100755
index 0000000..9f9ec64
--- /dev/null
+++ b/simpleton.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+import time, os, sys
+import urllib, ftplib, smtplib, yaml
+from termcolor import colored, cprint
+
+if len(sys.argv) < 2 or not os.path.exists(sys.argv[1]):
+ fh = open(os.path.join(os.getenv('HOME'), '.simpleton.yaml'))
+
+services = yaml.load(fh)
+tests, passed, started = (0, 0, time.time())
+
+for k, v in services.items():
+ for u in v:
+ tests += 1
+ msg = '* testing %s: %s' % (k, u)
+ out = colored(msg, 'green')
+ try:
+ if k == 'HTTP':
+ urllib.urlopen(u)
+ if k == 'FTP':
+ ftplib.FTP(u)
+ if k == 'SMTP':
+ smtplib.SMTP(u)
+ passed += 1
+ except Exception, e:
+ out = colored(msg, 'red')
+
+ print out
+
+print '%d of %d tests passed in %d seconds' % (passed, tests, int(time.time() - started))