コード例 #1
0
def processRemoveUser(name, password, frame):
    if len(name) == 0:
        messagebox.showerror("Error", "You cannot leave the name field blank")
        return
    elif config.getAdmin() == False:
        messagebox.showerror(
            "Insufficient Permissions",
            "You do not have the authorization to carry out this request")
        return
    elif password != config.getPassword():
        messagebox.showerror("Incorrect Password",
                             "Wrong password entered, could not verify user")
        return

    result = messagebox.askquestion(
        "Remove User", "Are you sure you want to remove " + name +
        " from our super secret group?")
    if "no" == result:
        return

    payload = {
        "RequestType": "REMOVE",
        "name": config.getName(),
        "password": config.getPassword(),
        "removalName": name
    }
    res = requests.post("http://mohamey.me/login.php", data=payload)
    if res.text == "User successfully removed":
        messagebox.showinfo("Success", "User successfully removed")
        login.destroyGrid(frame)
        generateRemoveUserFrame(frame)
    else:
        messagebox.showwarning("Result", res.text)
    return
コード例 #2
0
ファイル: vpn.py プロジェクト: ahpeh/datho-xbmc-repo
    def _allowAction(self, action, extra = ''):
        Logger.log("allowAction %s" % action, Logger.LOG_DEBUG)
        user = self._getUsername()
        pwd  = config.getPassword()

        data = {"username" : user, "apiKey" : pwd, "action" : action, "country" : self._countryName, "city" : self._cityName, "server" : self._serverAddress, "extra" : extra, "os" : config.getOS()}
        self._actionNotification.push(data)
コード例 #3
0
def processAddition(name, password, passwordConfirmation, admin, frame):
    if not config.getAdmin():
        messagebox.showerror(
            "Unauthorized",
            "You have insufficient permissions to carry out this action")
        return
    elif (len(name) == 0) or (len(password) == 0) or (len(admin) == 0):
        messagebox.showerror("Error", "You cannot leave any fields blank")
        return
    elif (password != passwordConfirmation) or len(password) == 0:
        messagebox.showerror(
            "Error",
            "The password confirmation does not match the password. Please try again"
        )
        return
    payload = {
        "RequestType": "CREATE",
        "name": config.getName(),
        "password": config.getPassword(),
        "newName": name,
        "newPass": password,
        "admin": admin
    }

    res = requests.post("http://mohamey.me/login.php", data=payload)
    if res.text == "Successfully created new user":
        messagebox.showinfo("Success", res.text)
        login.destroyGrid(frame)
        generateAddUserFrame(frame)
    else:
        messagebox.showwarning("Result", res.text)
    return
コード例 #4
0
def main():
    fromaddr = "*****@*****.**"
    cc = "[email protected],[email protected],[email protected]"

    names = [i.strip() for i in open("static/names.txt")]
    email = [i.strip() for i in open("static/email.txt")]
    assert (len(names) == len(email))
    # print(names)
    # print(email)

    start = 0
    if (len(sys.argv) != 1):
        start = int(sys.argv[1])
    for i in range(start, len(names)):
        print(i, names[i], email[i])
        companyName = names[i]
        toaddr = email[i]

        rcpt = cc.split(',') + [toaddr]

        msg = createMessage(fromaddr, toaddr, cc, companyName)

        server = smtplib.SMTP('smtp.gmail.com', 587)
        server.starttls()
        server.login(fromaddr, getPassword())
        text = msg.as_string()
        server.sendmail(fromaddr, rcpt, text)
        server.quit()
コード例 #5
0
def getFileNames():
    name = config.getName()
    password = config.getPassword()
    payload = {
        "name" : name,
        "password" : password,
        "RequestType" : "listDirectory"
    }
    res = requests.post("http://mohamey.me/login.php", data=payload)
    files = ((res.text)[5:]).split(",")
    return files
コード例 #6
0
def send_email(subject, message):
    try:
        server = smtplib.SMTP('smtp.gmail.com', port=587)
        server.ehlo()
        server.starttls()

        # login (email and password are in another python file for confidentiality)
        server.login(getEmail(), getPassword())
        msg = 'Subject: {} \n\n{}'.format(subject, message)
        server.sendmail(getEmail(), getEmail(), msg)
        server.close()
        print('Message sent successfully')
    except:
        print('Email failed to send')
コード例 #7
0
def uploadFile(fileLocation, frame):
    fileUpload = {"file" : open(fileLocation, 'rb')}
    payload = {
        "RequestType" : "uploadFile",
        "name" : config.getName(),
        "password" : config.getPassword()
    }
    res = requests.post("http://mohamey.me/login.php", data = payload, files=fileUpload)
    if res.text == "Successfully uploaded file":
        messagebox.showinfo("Result", res.text)
        destroyGrid(frame)
        generateMainWindow(frame)
    else:
        messagebox.showerror("Error", res.text)
コード例 #8
0
ファイル: vpn.py プロジェクト: krithia/datho-xbmc-repo
    def _allowAction(self, action, extra=''):
        Logger.log("allowAction %s" % action, Logger.LOG_DEBUG)
        user = self._getUsername()
        pwd = config.getPassword()

        data = {
            "username": user,
            "apiKey": pwd,
            "action": action,
            "country": self._countryName,
            "city": self._cityName,
            "server": self._serverAddress,
            "extra": extra,
            "os": config.getOS()
        }
        self._actionNotification.push(data)
コード例 #9
0
    def _getItemsFromBase(self):
        self._usingDathoVPNServers = False
        try:
            Logger.log("Trying to retrieve info from base", Logger.LOG_DEBUG)
            quoted_user = urllib2.quote(self.getPlainUsername(config.getUsername()))
            quoted_pass =  urllib2.quote(config.getPassword())
            ret = requests.get("https://www.dathovpn.com/service/addon/servers/%s/%s/" % (quoted_user, quoted_pass))
            result = self.REGEX.findall(ret.text)
            Logger.log("Retrieve from base ok result len:%s" %  len(result), Logger.LOG_DEBUG)
            if "<mode>Datho</mode>" in ret.text:
                self._usingDathoVPNServers = True

            return result
        except urllib2.URLError, e:
            Logger.log("There was an error while getting content from remote server %r" % e, Logger.LOG_INFO)
            return []
コード例 #10
0
ファイル: vpn.py プロジェクト: ahpeh/datho-xbmc-repo
    def _writeAuthentication(self):
        authPath = os.path.join(config.PROFILE, 'temp')
        common.CheckUsername()

        user = self._getUsername()
        pwd  = config.getPassword()

        if user == '' or pwd == '':
            gui.DialogOK(__language__(30029), __language__(30030), '')
            return None

        f = open(authPath, mode='w')
        data = [user, '\r\n', pwd, '\r\n']
        f.writelines(data)
        f.close()

        return authPath
コード例 #11
0
ファイル: vpn.py プロジェクト: martincad/xbmc-repo
    def _writeAuthentication(self):
        authPath = os.path.join(config.PROFILE, 'temp')
        common.CheckUsername()

        user = config.getUsername()
        pwd  = config.getPassword()

        if user == '' or pwd == '':
            gui.DialogOK('It is not possible to connect without credentials', 'Please set the username and password', '')
            return None

        f = open(authPath, mode='w')
        data = [user, '\r\n', pwd, '\r\n']
        f.writelines(data)
        f.close()

        return authPath
コード例 #12
0
ファイル: vpn.py プロジェクト: krithia/datho-xbmc-repo
    def _writeAuthentication(self):
        authPath = os.path.join(config.PROFILE, 'temp')
        common.CheckUsername()

        user = self._getUsername()
        pwd = config.getPassword()

        if user == '' or pwd == '':
            gui.DialogOK(__language__(30029), __language__(30030), '')
            return None

        f = open(authPath, mode='w')
        data = [user, '\r\n', pwd, '\r\n']
        f.writelines(data)
        f.close()

        return authPath
コード例 #13
0
ファイル: vpnmanager.py プロジェクト: wolf90/datho-xbmc-repo
    def _getItemsFromBase(self):
        self._usingDathoVPNServers = False
        try:
            Logger.log("Trying to retrieve info from base", Logger.LOG_DEBUG)
            quoted_user = urllib2.quote(
                self.getPlainUsername(config.getUsername()))
            quoted_pass = urllib2.quote(config.getPassword())
            ret = requests.get(
                "https://www.dathovpn.com/service/addon/servers/%s/%s/" %
                (quoted_user, quoted_pass))
            result = self.REGEX.findall(ret.text)
            Logger.log("Retrieve from base ok result len:%s" % len(result),
                       Logger.LOG_DEBUG)
            if "<mode>Datho</mode>" in ret.text:
                self._usingDathoVPNServers = True

            return result
        except urllib2.URLError, e:
            Logger.log(
                "There was an error while getting content from remote server %r"
                % e, Logger.LOG_INFO)
            return []
コード例 #14
0
		data = encrypted_request(text)
		try:
			return self.httpRequest('POST', action, data)
		except requests.exceptions.RequestException as e:
			log.error(e)
			return -1

	# 记录结果到本地的 txt 文件中

	def writeToFile(self, data):
		file = codecs.open(('qiandaoRecord' + '.txt'), 'a', 'utf-8')
		file.write(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())) + (data) + '\n')


ne = NetEase()
ne.login(config.getuser(), config.getPassword())
time.sleep(1)
# mobilesignin = \
mobilesignin = ne.daily_signin(0)
if mobilesignin != -1 and mobilesignin['code'] not in (-2, 301):
	# print('移动端签到成功')
	ne.writeToFile('移动端签到成功')
# elif mobilesignin == -2:
# 	ne.writeToFile('重复签到')
else:
	# print('移动签到失败')
	ne.writeToFile('移动签到失败')
time.sleep(1)
pcsignin = ne.daily_signin(1)
if pcsignin != -1 and pcsignin['code'] not in (-2, 301):
	# print('PC端签到成功')