0% found this document useful (0 votes)
33 views1 page

Terminal

This Python script creates a basic terminal interface that allows users to ping websites, view local IP/hostname information, check the date, list files and directories, and echo or print simple text. It imports necessary modules, prints an intro, then runs in a loop taking user input and running the requested command like ping, local, date, list, etc.

Uploaded by

123 Yt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views1 page

Terminal

This Python script creates a basic terminal interface that allows users to ping websites, view local IP/hostname information, check the date, list files and directories, and echo or print simple text. It imports necessary modules, prints an intro, then runs in a loop taking user input and running the requested command like ping, local, date, list, etc.

Uploaded by

123 Yt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import subprocess

import platform
import socket
import time
import os

path = 'C:/'
host_name = socket.gethostname()
host_ip = socket.gethostbyname(host_name)
print("Cyber Terminal [Version 1.00]")
while True:
code = input(">>> ")
if code == 'ping':
host = input("Enter Website To Ping: ")
number = input("Enter How Many Times To Ping: ")

def ping(host):
param = '-n' if platform.system().lower() == 'windows' else '-c'
command = ['ping', param, number, host]
return subprocess.call(command)
print(ping(host))
if code == 'local':
print("Your Local IPS Is: " + host_ip)
print("Your Desktop Name Is: " + host_name)

if code == 'date':
print("The Local Date Is: " + time.strftime("%m/%d/%Y"))

if code == 'list':
dir_list = os.listdir(path)
print("Files and Directories in '", path, "' :")
print(dir_list)

if code == 'list -a':


file = input("Enter The Direct File Path To Read: ")
dir_list2 = os.listdir(file)
print("Files and directories in '", file, "':")
print(dir_list2)

if code == 'echo me':


echo = input("What Do You Want Me To Echo: ")

if code == 'hi':
print("hi")

You might also like