Esempio n. 1
0
    def parse(settingsdir=None):
        if settingsdir == None:
            settingsdir = JitsiProperties.path
        p = Properties()
        p.load(open(os.path.join(settingsdir, JitsiProperties.propertiesfile)))
        keydict = dict()
        for item in p.items():
            propkey = item[0]
            name = ""
            if re.match("net\.java\.sip\.communicator\.impl\.protocol\.jabber\.acc[0-9]+\.ACCOUNT_UID", propkey):
                name = JitsiProperties._parse_account_uid(item[1])
                if name in keydict:
                    key = keydict[name]
                else:
                    key = dict()
                    key["name"] = name
                    key["protocol"] = "prpl-jabber"
                    keydict[name] = key

                propkey_base = "net.java.sip.communicator.plugin.otr." + re.sub("[^a-zA-Z0-9_]", "_", item[1])
                private_key = p.getProperty(propkey_base + "_privateKey").strip()
                public_key = p.getProperty(propkey_base + "_publicKey").strip()
                numdict = util.ParsePkcs8(private_key)
                key["x"] = numdict["x"]
                numdict = util.ParseX509(public_key)
                for num in ("y", "g", "p", "q"):
                    key[num] = numdict[num]
                key["fingerprint"] = util.fingerprint((key["y"], key["g"], key["p"], key["q"]))
                verifiedkey = (
                    "net.java.sip.communicator.plugin.otr."
                    + re.sub("[^a-zA-Z0-9_]", "_", key["name"])
                    + "_publicKey_verified"
                )
                if p.getProperty(verifiedkey).strip() == "true":
                    key["verification"] = "verified"
            elif re.match("net\.java\.sip\.communicator\.plugin\.otr\..*_publicKey_verified", propkey):
                name, protocol = JitsiProperties._parse_account_from_propkey(settingsdir, propkey)
                if name != None:
                    if name not in keydict:
                        key = dict()
                        key["name"] = name
                        keydict[name] = key
                    if protocol and "protocol" not in keydict[name]:
                        keydict[name]["protocol"] = protocol
                    keydict[name]["verification"] = "verified"
            # if the protocol name is included in the property name, its a local account with private key
            elif re.match("net\.java\.sip\.communicator\.plugin\.otr\..*_publicKey", propkey) and not re.match(
                "net\.java\.sip\.communicator\.plugin\.otr\.(Jabber_|Google_Talk_)", propkey
            ):
                name, ignored = JitsiProperties._parse_account_from_propkey(settingsdir, propkey)
                if name not in keydict:
                    key = dict()
                    key["name"] = name
                    key["protocol"] = "prpl-jabber"
                    keydict[name] = key
                numdict = util.ParseX509(item[1])
                for num in ("y", "g", "p", "q"):
                    key[num] = numdict[num]
                key["fingerprint"] = util.fingerprint((key["y"], key["g"], key["p"], key["q"]))
        return keydict
Esempio n. 2
0
    def parse(settingsdir=None):
        if settingsdir == None:
            settingsdir = JitsiProperties.path
        p = Properties()
        p.load(open(os.path.join(settingsdir, JitsiProperties.propertiesfile)))
        keydict = dict()
        for item in p.items():
            propkey = item[0]
            name = ''
            if re.match('net\.java\.sip\.communicator\.impl\.protocol\.jabber\.acc[0-9]+\.ACCOUNT_UID', propkey):
                name = JitsiProperties._parse_account_uid(item[1])
                if name in keydict:
                    key = keydict[name]
                else:
                    key = dict()
                    key['name'] = name
                    key['protocol'] = 'prpl-jabber'
                    keydict[name] = key

                propkey_base = ('net.java.sip.communicator.plugin.otr.'
                                + re.sub('[^a-zA-Z0-9_]', '_', item[1]))
                private_key = p.getProperty(propkey_base + '_privateKey').strip()
                public_key = p.getProperty(propkey_base + '_publicKey').strip()
                numdict = util.ParsePkcs8(private_key)
                key['x'] = numdict['x']
                numdict = util.ParseX509(public_key)
                for num in ('y', 'g', 'p', 'q'):
                    key[num] = numdict[num]
                key['fingerprint'] = util.fingerprint((key['y'], key['g'], key['p'], key['q']))
                verifiedkey = ('net.java.sip.communicator.plugin.otr.'
                               + re.sub('[^a-zA-Z0-9_]', '_', key['name'])
                               + '_publicKey_verified')
                if p.getProperty(verifiedkey).strip() == 'true':
                    key['verification'] = 'verified'
            elif (re.match('net\.java\.sip\.communicator\.plugin\.otr\..*_publicKey_verified', propkey)):
                name, protocol = JitsiProperties._parse_account_from_propkey(settingsdir, propkey)
                if name != None:
                    if name not in keydict:
                        key = dict()
                        key['name'] = name
                        keydict[name] = key
                    if protocol and 'protocol' not in keydict[name]:
                        keydict[name]['protocol'] = protocol
                    keydict[name]['verification'] = 'verified'
            # if the protocol name is included in the property name, its a local account with private key
            elif (re.match('net\.java\.sip\.communicator\.plugin\.otr\..*_publicKey', propkey) and not
                  re.match('net\.java\.sip\.communicator\.plugin\.otr\.(Jabber_|Google_Talk_)', propkey)):
                name, ignored = JitsiProperties._parse_account_from_propkey(settingsdir, propkey)
                if name not in keydict:
                    key = dict()
                    key['name'] = name
                    key['protocol'] = 'prpl-jabber'
                    keydict[name] = key
                numdict = util.ParseX509(item[1])
                for num in ('y', 'g', 'p', 'q'):
                    key[num] = numdict[num]
                key['fingerprint'] = util.fingerprint((key['y'], key['g'], key['p'], key['q']))
        return keydict
Esempio n. 3
0
def get_property_value(property_name):

    cur_path = os.getcwd()
    ui_map_file = os.path.join(cur_path, '..' + os.sep,
                               'STAF_Config' + os.sep + 'ui_map.properties')
    ui_map_file = os.path.abspath(ui_map_file)

    prop = Properties()
    prop.load(open(ui_map_file))

    if prop.getProperty(property_name).strip() == "":
        return "Property not found"
    else:
        return prop.getProperty(property_name)
Esempio n. 4
0
def format(file):

    p = Properties()
    p.load(open('res/proj.properties'))

    dt = datetime.datetime.now().strftime("%Y%m%d%H%M")

    try:
        for line in open(file, 'r'):
            parsed = json.loads(line)
            formatted_outfile = str(p.getProperty('FORMATTEDOUTFILE')) + "sendbirdy-" + dt + ".json"
            try:
                f = open(formatted_outfile, "a")
                f.write(json.dumps(parsed, indent=4, sort_keys=True))
                f.close()
            except IOError as io:
                print("{!}----- I/O error({0}): {1}"+ format(io.errno))
    except Exception as e:
        print(c.indent_msg + c.indent_err + e)

    print(c.indent_msg + c.indent_info + " Output Located : [" + formatted_outfile)


    return
Esempio n. 5
0
File: jitsi.py Progetto: duy/keysync
    def parse(settingsdir=None):
        if settingsdir == None:
            settingsdir = JitsiProperties.path
        p = Properties()
        p.load(open(os.path.join(settingsdir, JitsiProperties.propertiesfile)))
        keydict = dict()
        for item in p.items():
            propkey = item[0]
            name = ''
            if re.match(
                    'net\.java\.sip\.communicator\.impl\.protocol\.jabber\.acc[0-9]+\.ACCOUNT_UID',
                    propkey):
                name = JitsiProperties._parse_account_uid(item[1])
                if name in keydict:
                    key = keydict[name]
                else:
                    key = dict()
                    key['name'] = name
                    key['protocol'] = 'prpl-jabber'
                    keydict[name] = key

                propkey_base = ('net.java.sip.communicator.plugin.otr.' +
                                re.sub('[^a-zA-Z0-9_]', '_', item[1]))
                private_key = p.getProperty(propkey_base +
                                            '_privateKey').strip()
                public_key = p.getProperty(propkey_base + '_publicKey').strip()
                numdict = util.ParsePkcs8(private_key)
                key['x'] = numdict['x']
                numdict = util.ParseX509(public_key)
                for num in ('y', 'g', 'p', 'q'):
                    key[num] = numdict[num]
                key['fingerprint'] = util.fingerprint(
                    (key['y'], key['g'], key['p'], key['q']))
                verifiedkey = ('net.java.sip.communicator.plugin.otr.' +
                               re.sub('[^a-zA-Z0-9_]', '_', key['name']) +
                               '_publicKey_verified')
                if p.getProperty(verifiedkey).strip() == 'true':
                    key['verification'] = 'verified'
            elif (re.match(
                    'net\.java\.sip\.communicator\.plugin\.otr\..*_publicKey_verified',
                    propkey)):
                name, protocol = JitsiProperties._parse_account_from_propkey(
                    settingsdir, propkey)
                if name != None:
                    if name not in keydict:
                        key = dict()
                        key['name'] = name
                        keydict[name] = key
                    if protocol and 'protocol' not in keydict[name]:
                        keydict[name]['protocol'] = protocol
                    keydict[name]['verification'] = 'verified'
            # if the protocol name is included in the property name, its a local account with private key
            elif (re.match(
                    'net\.java\.sip\.communicator\.plugin\.otr\..*_publicKey',
                    propkey
            ) and not re.match(
                    'net\.java\.sip\.communicator\.plugin\.otr\.(Jabber_|Google_Talk_)',
                    propkey)):
                name, ignored = JitsiProperties._parse_account_from_propkey(
                    settingsdir, propkey)
                if name not in keydict:
                    key = dict()
                    key['name'] = name
                    key['protocol'] = 'prpl-jabber'
                    keydict[name] = key
                numdict = util.ParseX509(item[1])
                for num in ('y', 'g', 'p', 'q'):
                    key[num] = numdict[num]
                key['fingerprint'] = util.fingerprint(
                    (key['y'], key['g'], key['p'], key['q']))
        return keydict
Esempio n. 6
0
from pyjavaproperties import Properties

file_path = "/Users/smandaki/PycharmProjects/DataDriven/data/config.properties"
input_stream = open(file_path, mode='r')
prop = Properties()
prop.load(input_stream)
bName = prop.getProperty("browser")
UserName = prop.getProperty("username")

print(bName)
print(UserName)
input_stream.close()
def main():
    
    properties = Properties()
    properties.load(open("/home/khepry/home/distributions/PyDataGenerator/PyDataGenerator.properties"))
    properties.list()

    maxRows = 100
    maxXlsRows = 10000
    
    globalPath = '/home/khepry/home/distributions/PyDataGenerator/temp/'
    targetName = 'dataGenerator.csv'

    maxRows = int(properties.getProperty('maxRows', maxRows))
    maxXlsRows = int(properties.getProperty('maxXlsRows', maxXlsRows))

    globalPath = properties.getProperty('globalPath', globalPath)
    targetName = properties.getProperty('targetName', targetName)
    
    print("-- operating system --")
    print(platform.system())
    
    print("-- processing messages --")
    
    if platform.system() == 'Windows':
        xlsPgmPath = '"/Program Files/Microsoft Office 15/root/office15/EXCEL.EXE"'
        txtPgmPath = '"/Program Files (x86)/Notepad++/notepad++.exe"'
    else:
        xlsPgmPath = "libreoffice"
        txtPgmPath = "gedit"
    
    tgtFileFullPath = os.path.abspath(globalPath + targetName)
    tgtFile = open(tgtFileFullPath, 'w', newline='')

    bgnTime = tyme.time()

    rows = 0
    
    try:
        writer = csv.writer(tgtFile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)

        for i in range(0, maxRows):
            rows += 1
            
            record = Record()
            record.addField("UUID4", "UUID4").random()
            record.addField("Alpha", "Alpha").random(20, 25)
            record.addField("AlphaNumeric", "AlphaNumeric").random()
            record.addField("Numeric", "Numeric").random()
            record.addField("String", "String").random()
            record.addField("Range", "Range").random(12, 24)
            record.addField("Date", "Date").random(date(1980,1,1), date(2000,12,31))
            record.addField("DateTime", "DateTime").random(date(1980,1,1), date(2000,12,31))
            record.addField("AgeInYears","Numeric").years(date.today(), record.getField("Date").value)
            record.addField("AgeInMonths","Numeric").months(date.today(), record.getField("Date").value)
            record.addField("AgeInDays","Numeric").days(date.today(), record.getField("Date").value)
                
            if (i == 0):
                writer.writerow([key for key in record.fields.keys()])
            writer.writerow([field.text for field in record.fields.values()])
            
    finally:
        tgtFile.close()


    endTime = tyme.time()

    elapsedTime = endTime - bgnTime

    print("{:,}".format(rows) + ' records processed in ' + "{:,.4f}".format(elapsedTime) + ' seconds at ' + "{:,.4f}".format(rows / elapsedTime) + ' rows/second.')

    if (platform.system() == 'Windows'):
        if (rows < maxXlsRows):
            subprocess.call(xlsPgmPath + ' "' + tgtFileFullPath + '"')
        else:
            subprocess.call(txtPgmPath + ' "' + tgtFileFullPath + '"')
    else:
        if (rows < maxXlsRows):
            subprocess.call([xlsPgmPath, tgtFileFullPath])
        else:
            subprocess.call([txtPgmPath, tgtFileFullPath])
Esempio n. 8
0
def getValue(key, path):
    prop = Properties()
    file = open(path, 'r')
    prop.load(file)
    return prop.getProperty(key)
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.firefox import GeckoDriverManager

from pyjavaproperties import Properties

prop = Properties()
# path for win c:\\Users\\Marvel\\testData\\config.properties
prop.load(open("../testData/config.properties"))

if prop.getProperty("browser") == "chrome":
    driver = webdriver.Chrome(ChromeDriverManager().install())
elif prop.getProperty("browser") == 'firefox':
    driver = webdriver.Firefox(GeckoDriverManager().install())



driver.get(prop.getProperty("url"))





Esempio n. 10
0
from pyjavaproperties import Properties

file_name="/Users/smandaki/PycharmProjects/DataDriven/data/config.properties"
output_Sterm=open(file_name, "a")
prop= Properties()
prop.setProperty(key='ValueOfPi', value="double,valueTesting")
prop.store(output_Sterm)
output_Sterm.close()

input_stream=open(file_name, "r")
prop1=Properties()
prop1.load(input_stream)
newval=prop.getProperty("ValueOfPi")
Str1=newval.split(',')
print(Str1[0])
print(Str1[1])
input_stream.close()

'''
file_path = "/Users/smandaki/PycharmProjects/DataDriven/data/config.properties"
output_file = open(file_path, 'a')
prop = Properties()
prop.setProperty(key="Users", value='Agent,Admin')
prop.store(output_file)
output_file.close()


input_stream = open(file_path, mode='r')
prop = Properties()
prop.load(input_stream)
Esempio n. 11
0
def requestSender(app):

    p = Properties()
    p.load(open('res/proj.properties'))

    ts = time.gmtime()
    dt = datetime.datetime.now().strftime("%Y%m%d%H%M")

    outdir = str(p.getProperty("OUTDIR"))
    outfile = outdir + dt + ".json"

    ## Define the GET Request URL
    urlHeader = parser.parse_headers(c.app, 'url-format', 'urlheader')
    urlTail = parser.parse_headers(c.app, 'url-format', 'urlTail')
    url = urlHeader + parser.parse_yaml(c.app, 'sendbird-id') + urlTail
    print("{!} " + url)

    # Determine how many round need to be run (due to response limit of 100)
    #       note that response limit can change and is set by API admin
    numOfRound = c.users_to_enumerate / 100
    roundCounter = numOfRound

    # TODO replace hard-coded headers and ploads with YAML file ones
    i = 1
    while roundCounter > 0:
        print("{!}----- Staring sendbirdy round [" + str(i) + "]-----")
        ploads = {'public_mode': 'all'}
        ploads['limit'] = parser.parse_yaml(c.app, 'request_limit')

        # This is where the vulnerability lies, not all users should have access to the /v3/users/ directory
        # Some implementation of sendbird restrict access here, and only allow authenticated users to the /v3/users/[user-id] directory
        headers = {
            'Accept-Encoding': 'gzip, deflate',
            'SendBird':
            'iOS,13.5,3.0.178,3CDAD91C-1E0D-4A0D-BBEE-9671988BF9E9',
            'Request-Sent-Timestamp': '1591543666234',
            'Accept': 'application/json',
            'User-Agent': 'Jios/3.0.178',
            'SB-User-Agent': 'iOS/c3.0.178',
            'Accept-Language': 'en-ca',
        }
        headers['Host'] = parser.parse_yaml(c.app,
                                            'sendbird-id') + '.sendbird.com'
        headers['Session-Key'] = parser.parse_yaml(c.app, 'session-token')

        # Make GET request from applicaiton server,
        r = requests.get(url, params=ploads, headers=headers)

        try:
            f = open(outfile, "a")
            f.write(r.text + '\n')
            f.close()
        except IOError as e:
            print("{!}----- I/O error({0}): {1} Could not find" + outfile)

        roundCounter -= 1
        i += 1
        print("{!}----- Sleeping for 5 seconds [x]-----")
        time.sleep(5)

    print("{!}----- Gathered [" + str(numOfRound * 100) +
          "] user details-----")
    print(c.indent_msg + c.indent_info + " Gathered [" +
          str(numOfRound * 100) + "] user details-----")
    print(c.indent_msg + c.indent_info + " Output Located : [" + outfile)

    formatter.format(outfile)

    return