From 71e68c21da4dfb163b9da7c244f6b8f765ee781f Mon Sep 17 00:00:00 2001 From: mamang Date: Fri, 19 Oct 2018 20:02:27 +0800 Subject: [PATCH] Delete 'ping-service.py' --- ping-service.py | 77 ------------------------------------------------- 1 file changed, 77 deletions(-) delete mode 100755 ping-service.py diff --git a/ping-service.py b/ping-service.py deleted file mode 100755 index 7fe780e..0000000 --- a/ping-service.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/python - -import sys, subprocess, re -from os import system as MaManX - -def make_secure(): - unsafe_word = ['__import__', 'eval', 'execfile', 'file', 'input', 'compile', 'reload'] - for unsafe in unsafe_word: - del __builtins__.__dict__[unsafe] - -class Unbuffered(object): - def __init__(self, stream): - self.stream = stream - def write(self, data): - self.stream.write(data) - self.stream.flush() - def writelines(self, datas): - self.stream.writelines(datas) - self.stream.flush() - def __getattr__(self, attr): - return getattr(self.stream, attr) - -sys.stdout = Unbuffered(sys.stdout) - -def banner(): - return ''' -\033[1;32mWELCOME TO MAMANX PINX SERVICE\033[1;m\033[1;31m - _ __ _____ _ _____ _____ _ _ _____ _____ _____ _____ _ _ _____ _____ _____ -| | / // ___|| | | ___ \|_ _|| \ | || __ \ / ___|| ___|| ___ \| | | ||_ _|/ __ \| ___| -| |/ / \ `--. | | | |_/ / | | | \| || | \/ \ `--. | |__ | |_/ /| | | | | | | / \/| |__ -| \ `--. \| | | __/ | | | . ` || | __ `--. \| __| | / | | | | | | | | | __| -| |\ \/\__/ /| |____ | | _| |_ | |\ || |_\ \ /\__/ /| |___ | |\ \ \ \./ / _| |_ | \__/\| |___ -\_| \_/\____/ \_____/ \_| \___/ \_| \_/ \____/ \____/ \____/ \_| \_| \___/ \___/ \_____/\____/ - \033[1;m -\033[1;32mversion [beta 1.1 MAMANK]\033[1;m - ''' -def displayMenu(): - return ''' -Choose a ksl ping service: - 1. Ping only one time - 2. Ping multiple times - 3. Exit MaManX -''' - -def main(): - make_secure() - print banner() - print displayMenu() - - userNumber = raw_input("Masukkan pilihan (1-3): ") - if userNumber == "1" : - host = raw_input("\nMasukkan alamat host : ") - p1 = subprocess.Popen(['ping','-c 5', host], stdout=subprocess.PIPE) - output = p1.communicate()[0] - print output - exit() - elif userNumber == "2" : - user = int(raw_input("\nMasukkan jumlah host: ")) - while user <= 1: - user = int(raw_input("\nMasukkan host lebih dari 1 MaManX: ")) - for o in range(user): - host = raw_input("Masukkan alamat host ke " +str(o+1) +" : ") - hosts= re.sub('[|,;]', '', host) - pings = MaManX('ping -c 5 ' + hosts ) - if (pings == 0): - print host.upper(), "IS UP MAMANX" - else : - print host.upper(), "IS LOST MAMANX" - print "" - elif userNumber == "3" : - print "\nTerimakasih telah menggunakan jasa kami MaManX" - exit() - else : - print "\nMaManX salah masukkin acchh :(" - exit() - -main()