Exemplo n.º 1
0
 def save_proxies(self):
     list_name = self.listname_edit.text()
     proxies = self.proxies_edit.toPlainText()
     if proxies != "" and list_name != "":
         for item in proxies.splitlines():
             if ":" not in item or item == "":
                 QtWidgets.QMessageBox.critical(self, "Phoenix Bot",
                                                "Incorrect Proxies")
                 return
         proxies_data = {
             "list_name": list_name,
             "proxies": self.proxies_edit.toPlainText()
         }
         proxies = return_data("./data/proxies.json")
         for p in proxies:
             if p["list_name"] == list_name:
                 proxies.remove(p)
                 break
         proxies.append(proxies_data)
         write_data("./data/proxies.json", proxies)
         if self.loadlist_box.findText(list_name) == -1:
             self.loadlist_box.addItem(list_name)
             self.parent().parent().createdialog.proxies_box.addItem(
                 list_name)
         QtWidgets.QMessageBox.information(self, "Phoenix Bot",
                                           "Saved Proxies")
     else:
         QtWidgets.QMessageBox.critical(self, "Phoenix Bot",
                                        "Missing Fields")
Exemplo n.º 2
0
 def __init__(self,
              site,
              product,
              profile,
              proxies,
              monitor_delay,
              error_delay,
              max_price,
              stop_all,
              parent=None):
     super(TaskTab, self).__init__(parent)
     self.task_id = str(int(tasks_total_count.text()) + 1)
     tasks_total_count.setText(self.task_id)
     self.site, self.product, self.profile, self.proxies, self.monitor_delay, self.error_delay, self.max_price, self.stop_all = site, product, profile, proxies, monitor_delay, error_delay, max_price, stop_all
     self.setupUi(self)
     tasks.append(self)
     tasks_data = return_data("./data/tasks.json")
     task_data = {
         "task_id": self.task_id,
         "site": self.site,
         "product": self.product,
         "profile": self.profile,
         "proxies": self.proxies,
         "monitor_delay": self.monitor_delay,
         "error_delay": self.error_delay,
         "max_price": self.max_price
     }
     tasks_data.append(task_data)
     write_data("./data/tasks.json", tasks_data)
Exemplo n.º 3
0
 def load_tasks(self):
     tasks_data = return_data("./data/tasks.json")
     write_data("./data/tasks.json", [])
     try:
         for task in tasks_data:
             tab = TaskTab(
                 task["site"],
                 task["product"],
                 task["profile"],
                 task["proxies"],
                 task["monitor_delay"],
                 task["error_delay"],
                 task["max_price"],
                 self.stop_all_tasks,
                 self.scrollAreaWidgetContents,  # parent
             )
             self.verticalLayout.takeAt(self.verticalLayout.count() - 1)
             self.verticalLayout.addWidget(tab)
             spacerItem = QtWidgets.QSpacerItem(
                 20,
                 40,
                 QtWidgets.QSizePolicy.Minimum,
                 QtWidgets.QSizePolicy.Expanding,
             )
             self.verticalLayout.addItem(spacerItem)
     except:
         pass
Exemplo n.º 4
0
 def set_data(self):
     for state in [
             "AL", "AK", "AS", "AZ", "AR", "CA", "CO", "CT", "DE", "DC",
             "FM", "FL", "GA", "GU", "HI", "ID", "IL", "IN", "IA", "KS",
             "KY", "LA", "ME", "MH", "MD", "MA", "MI", "MN", "MS", "MO",
             "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "MP",
             "OH", "OK", "OR", "PW", "PA", "PR", "RI", "SC", "SD", "TN",
             "TX", "UT", "VT", "VI", "VA", "WA", "WV", "WI", "WY"
     ]:
         self.shipping_state_box.addItem(state)
         self.billing_state_box.addItem(state)
     for month in range(1, 13):
         self.cardmonth_box.addItem(
             str(month)) if month > 9 else self.cardmonth_box.addItem(
                 "0" + str(month))
     for year in range(2020, 2031):
         self.cardyear_box.addItem(str(year))
     for card_type in [
             "Visa", "Mastercard", "American Express", "Discover"
     ]:
         self.cardtype_box.addItem(card_type)
     profiles = return_data("./data/profiles.json")
     for profile in profiles:
         profile_name = profile["profile_name"]
         self.loadprofile_box.addItem(profile_name)
         self.parent().parent().createdialog.profile_box.addItem(
             profile_name)
Exemplo n.º 5
0
    def set_data(self):
        settings = return_data("./data/settings.json")
        self.webhook_edit.setText(settings["webhook"])
        if settings["webhookonbrowser"]:
            self.browser_checkbox.setChecked(True)
        if settings["webhookonorder"]:
            self.order_checkbox.setChecked(True)
        if settings["webhookonfailed"]:
            self.paymentfailed_checkbox.setChecked(True)
        if settings["browseronfailed"]:
            self.onfailed_checkbox.setChecked(True)
        if settings["bb_ac_beta"]:
            self.bb_ac_beta_checkbox.setChecked(True)
        if settings['onlybuyone']:
            self.buy_one_checkbox.setChecked(True)
        if settings['dont_buy']:
            self.dont_buy_checkbox.setChecked(True)
        if settings['random_delay_start']:
            self.random_delay_start.setText(settings["random_delay_start"])
        if settings['random_delay_stop']:
            self.random_delay_stop.setText(settings["random_delay_stop"])

        try:
            self.bestbuy_user_edit.setText(settings["bestbuy_user"])
        except:
            self.bestbuy_user_edit.setText("")

        try:
            self.bestbuy_pass_edit.setText((Encryption().decrypt(
                settings["bestbuy_pass"].encode("utf-8"))).decode("utf-8"))
        except:
            self.bestbuy_pass_edit.setText("")

        self.update_settings(settings)
Exemplo n.º 6
0
 def update_task(self):
     self.site = self.edit_dialog.site_box.currentText()
     self.product = self.edit_dialog.input_edit.text()
     self.profile = self.edit_dialog.profile_box.currentText()
     self.proxies = self.edit_dialog.proxies_box.currentText()
     self.monitor_delay = self.edit_dialog.monitor_edit.text()
     self.error_delay = self.edit_dialog.error_edit.text()
     self.max_price = self.edit_dialog.price_edit.text()
     self.load_labels()
     self.delete_json()
     tasks_data = return_data("./data/tasks.json")
     task_data = {
         "task_id": self.task_id,
         "site": self.site,
         "product": self.product,
         "profile": self.profile,
         "proxies": self.proxies,
         "monitor_delay": self.monitor_delay,
         "error_delay": self.error_delay,
         "max_price": self.max_price
     }
     tasks_data.append(task_data)
     tasks_data = sorted(tasks_data, key=lambda i: i["site"])
     write_data("./data/tasks.json", tasks_data)
     self.edit_dialog.deleteLater()
Exemplo n.º 7
0
 def delete_json(self):
     tasks_data = return_data("./data/tasks.json")
     for task in tasks_data:
         if task["task_id"] == self.task_id:
             tasks_data.remove(task)
             break
     write_data("./data/tasks.json", tasks_data)
Exemplo n.º 8
0
 def load_proxies(self):
     list_name = self.loadlist_box.currentText()
     if list_name != "Load Proxies":
         proxies = return_data("./data/proxies.json")
         for proxies_list in proxies:
             if proxies_list["list_name"] == list_name:
                 self.listname_edit.setText(list_name)
                 self.proxies_edit.setText(proxies_list["proxies"])
Exemplo n.º 9
0
def crt(request):
    base = "91301800016"

    for i in xrange(22001, 42001):
        obj = OilCard.objects.create(card=base+str(i))
        obj.save()

    return JsonResponse(return_data(status="OK", code=0, msg="Insert Success!"))
Exemplo n.º 10
0
 def delete(self,event):
     tasks_total_count.setText(str(int(tasks_total_count.text())-1))
     tasks_data = return_data("./tasks.json")
     for task in tasks_data:
         if task["task_id"] == self.task_id:
             tasks_data.remove(task)
             break
     write_data("./tasks.json",tasks_data)
     self.TaskTab.deleteLater()
Exemplo n.º 11
0
 def set_data(self):
     settings = return_data("./data/settings.json")
     self.webhook_edit.setText(settings["webhook"])
     if settings["webhookonbrowser"]:
         self.browser_checkbox.setChecked(True)
     if settings["webhookonorder"]:
         self.order_checkbox.setChecked(True)
     if settings["webhookonfailed"]:
         self.paymentfailed_checkbox.setChecked(True)
     if settings["browseronfailed"]:
         self.onfailed_checkbox.setChecked(True)
     self.update_settings(settings)
Exemplo n.º 12
0
def signin(request):
    """ Signin Page """
    if request.method == 'POST':
        today = date.today()
        search_opts = {
            "user": request.user,
            "year": today.year,
            "month": today.month,
            "day": today.day
        }
        is_exists = SignIn.objects.filter(**search_opts).exists()
        if not is_exists:
            obj = SignIn.objects.create(**search_opts)
            obj.save()
            msg = "签到成功!"
            return JsonResponse(return_data(status="OK", code=0, msg=msg))
        msg = "请勿重复签到!"
        return JsonResponse(return_data(msg=msg))
    days = SignIn.objects.filter(user=request.user).count()
    days = days % 30
    return render(request, 'signin.html', {"days": days})
Exemplo n.º 13
0
 def delete_proxies(self):
     list_name = self.listname_edit.text()
     proxies = return_data("./data/proxies.json")
     for p in proxies:
         if p["list_name"] == list_name:
             proxies.remove(p)
             break
     write_data("./data/proxies.json",proxies)
     self.loadlist_box.removeItem(self.loadlist_box.findText(list_name))
     self.parent().parent().createdialog.proxies_box.removeItem(self.parent().parent().createdialog.proxies_box.findText(list_name))
     self.loadlist_box.setCurrentIndex(0)
     self.listname_edit.setText("")
     self.proxies_edit.setText("")
     QtWidgets.QMessageBox.information(self, "Bytesize Bot", "Deleted Proxy List")
Exemplo n.º 14
0
 def set_data(self):
     self.shipping_state_box.clear()
     self.billing_state_box.clear()
     self.shipping_country_box.currentTextChanged.connect(self.updateShippingStateBox)
     self.billing_country_box.currentTextChanged.connect(self.updateBillingStateBox)
     for month in range(1,13):
         self.cardmonth_box.addItem(str(month)) if month>9 else self.cardmonth_box.addItem("0"+str(month))
     for year in range(2020,2031):
         self.cardyear_box.addItem(str(year))
     for card_type in ["Visa", "Mastercard", "American Express", "Discover"]:
         self.cardtype_box.addItem(card_type)
     profiles = return_data("./data/profiles.json")
     for profile in profiles:
         profile_name = profile["profile_name"]
         self.loadprofile_box.addItem(profile_name)
         self.parent().parent().createdialog.profile_box.addItem(profile_name)
Exemplo n.º 15
0
 def set_data(self):
     settings = return_data("./data/settings.json")
     self.webhook_edit.setText(settings["webhook"])
     if settings["webhookonbrowser"]:
         self.browser_checkbox.setChecked(True)
     if settings["webhookonorder"]:
         self.order_checkbox.setChecked(True)
     if settings["webhookonfailed"]:
         self.paymentfailed_checkbox.setChecked(True)
     if settings["browseronfailed"]:
         self.onfailed_checkbox.setChecked(True)
     if settings['onlybuyone']:
         self.buy_one_checkbox.setChecked(True)
     if settings['dont_buy']:
         self.dont_buy_checkbox.setChecked(True)
     self.random_delay_start.setText(settings["random_delay_start"])
     self.random_delay_stop.setText(settings["random_delay_stop"])
     self.update_settings(settings)
Exemplo n.º 16
0
    def delete_profile(self):
        profile_name = self.profilename_edit.text()
        profiles = return_data("./data/profiles.json")
        for profile in profiles:
            if profile["profile_name"] == profile_name:
                profiles.remove(profile)
                break
        write_data("./data/profiles.json", profiles)
        self.loadprofile_box.removeItem(
            self.loadprofile_box.findText(profile_name))
        self.parent().parent().createdialog.profile_box.removeItem(
            self.parent().parent().createdialog.profile_box.findText(
                profile_name))

        self.loadprofile_box.setCurrentIndex(0)
        self.profilename_edit.setText("")
        self.profilename_edit.setText("")
        self.shipping_fname_edit.setText("")
        self.shipping_lname_edit.setText("")
        self.shipping_email_edit.setText("")
        self.shipping_phone_edit.setText("")
        self.shipping_address1_edit.setText("")
        self.shipping_address2_edit.setText("")
        self.shipping_city_edit.setText("")
        self.shipping_zipcode_edit.setText("")
        self.shipping_state_box.setCurrentIndex(0)
        self.shipping_country_box.setCurrentIndex(0)
        self.billing_fname_edit.setText("")
        self.billing_lname_edit.setText("")
        self.billing_email_edit.setText("")
        self.billing_phone_edit.setText("")
        self.billing_address1_edit.setText("")
        self.billing_address2_edit.setText("")
        self.billing_city_edit.setText("")
        self.billing_zipcode_edit.setText("")
        self.billing_state_box.setCurrentIndex(0)
        self.billing_country_box.setCurrentIndex(0)
        self.cardnumber_edit.setText("")
        self.cardmonth_box.setCurrentIndex(0)
        self.cardyear_box.setCurrentIndex(0)
        self.cardtype_box.setCurrentIndex(0)
        self.cardcvv_edit.setText("")
        QtWidgets.QMessageBox.information(self, "Phoenix Bot",
                                          "Deleted Profile")
Exemplo n.º 17
0
 def save_profile(self):
     profile_name = self.profilename_edit.text()
     profile_data = {
         "profile_name": profile_name,
         "shipping_fname": self.shipping_fname_edit.text(),
         "shipping_lname": self.shipping_lname_edit.text(),
         "shipping_email": self.shipping_email_edit.text(),
         "shipping_phone": self.shipping_phone_edit.text(),
         "shipping_a1": self.shipping_address1_edit.text(),
         "shipping_a2": self.shipping_address2_edit.text(),
         "shipping_city": self.shipping_city_edit.text(),
         "shipping_zipcode": self.shipping_zipcode_edit.text(),
         "shipping_state": self.shipping_state_box.currentText(),
         "shipping_country": self.shipping_country_box.currentText(),
         "billing_fname": self.billing_fname_edit.text(),
         "billing_lname": self.billing_lname_edit.text(),
         "billing_email": self.billing_email_edit.text(),
         "billing_phone": self.billing_phone_edit.text(),
         "billing_a1": self.billing_address1_edit.text(),
         "billing_a2": self.billing_address2_edit.text(),
         "billing_city": self.billing_city_edit.text(),
         "billing_zipcode": self.billing_zipcode_edit.text(),
         "billing_state": self.billing_state_box.currentText(),
         "billing_country": self.billing_country_box.currentText(),
         "card_number": self.cardnumber_edit.text(),
         "card_month": self.cardmonth_box.currentText(),
         "card_year": self.cardyear_box.currentText(),
         "card_type": self.cardtype_box.currentText(),
         "card_cvv": self.cardcvv_edit.text()
     }
     profiles = return_data("./data/profiles.json")
     for p in profiles:
         if p["profile_name"] == profile_name:
             profiles.remove(p)
             break
     profiles.append(profile_data)
     write_data("./data/profiles.json", profiles)
     if self.loadprofile_box.findText(profile_name) == -1:
         self.loadprofile_box.addItem(profile_name)
         self.parent().parent().createdialog.profile_box.addItem(
             profile_name)
     QtWidgets.QMessageBox.information(self, "Bird Bot", "Saved Profile")
Exemplo n.º 18
0
 def load_profile(self):
     profile_name = self.loadprofile_box.currentText()
     profiles = return_data("./data/profiles.json")
     for p in profiles:
         if p["profile_name"] == profile_name:
             self.profilename_edit.setText(p["profile_name"])
             self.shipping_fname_edit.setText(p["shipping_fname"])
             self.shipping_lname_edit.setText(p["shipping_lname"])
             self.shipping_email_edit.setText(p["shipping_email"])
             self.shipping_phone_edit.setText(p["shipping_phone"])
             self.shipping_address1_edit.setText(p["shipping_a1"])
             self.shipping_address2_edit.setText(p["shipping_a2"])
             self.shipping_city_edit.setText(p["shipping_city"])
             self.shipping_zipcode_edit.setText(p["shipping_zipcode"])
             self.shipping_state_box.setCurrentIndex(
                 self.shipping_state_box.findText(p["shipping_state"]))
             self.shipping_country_box.setCurrentIndex(
                 self.shipping_country_box.findText(p["shipping_country"]))
             self.billing_fname_edit.setText(p["billing_fname"])
             self.billing_lname_edit.setText(p["billing_lname"])
             self.billing_email_edit.setText(p["billing_email"])
             self.billing_phone_edit.setText(p["billing_phone"])
             self.billing_address1_edit.setText(p["billing_a1"])
             self.billing_address2_edit.setText(p["billing_a2"])
             self.billing_city_edit.setText(p["billing_city"])
             self.billing_zipcode_edit.setText(p["billing_zipcode"])
             self.billing_state_box.setCurrentIndex(
                 self.billing_state_box.findText(p["billing_state"]))
             self.billing_country_box.setCurrentIndex(
                 self.billing_country_box.findText(p["billing_country"]))
             self.cardnumber_edit.setText(p["card_number"])
             self.cardmonth_box.setCurrentIndex(
                 self.cardmonth_box.findText(p["card_month"]))
             self.cardyear_box.setCurrentIndex(
                 self.cardyear_box.findText(p["card_year"]))
             self.cardtype_box.setCurrentIndex(
                 self.cardtype_box.findText(p["card_type"]))
             self.cardcvv_edit.setText(p["card_cvv"])
             return
Exemplo n.º 19
0
    def set_data(self):

        settings_default = return_data("./data/settings_default.json")
        if data_exists("./data/settings.json"):
            settings = return_data("./data/settings.json")
        else:
            logger.alt(
                "Set-Settings-Data",
                "No existing settings found to be parsed, creating new from default."
            )
            write_data("./data/settings.json", settings_default)
            settings = return_data("./data/settings.json")

        if not validate_data(settings, settings_default):
            logger.error(
                "Set-Settings-Data", "Parsed settings data is malformed! "
                "This will most likely cause a fatal exception. "
                "Try removing existing settings.json")

        self.webhook_edit.setText(settings["webhook"])
        if settings["webhookonbrowser"]:
            self.browser_checkbox.setChecked(True)
        if settings["webhookonorder"]:
            self.order_checkbox.setChecked(True)
        if settings["webhookonfailed"]:
            self.paymentfailed_checkbox.setChecked(True)
        if settings["browseronfailed"]:
            self.onfailed_checkbox.setChecked(True)
        if settings["runheadless"]:
            self.headless_checkbox.setChecked(True)
        if settings["bb_ac_beta"]:
            self.bb_ac_beta_checkbox.setChecked(True)
        if settings['onlybuyone']:
            self.buy_one_checkbox.setChecked(True)
        if settings['dont_buy']:
            self.dont_buy_checkbox.setChecked(True)
        if settings['random_delay_start']:
            self.random_delay_start.setText(settings["random_delay_start"])
        if settings['random_delay_stop']:
            self.random_delay_stop.setText(settings["random_delay_stop"])

        self.geckodriver_path = settings["geckodriver"]

        # try:
        #     self.geckodriver.setText(settings["geckodriver"])
        # except:
        #     self.geckodriver.setText("")

        try:
            self.bestbuy_user_edit.setText(settings["bestbuy_user"])
        except:
            self.bestbuy_user_edit.setText("")

        try:
            self.bestbuy_pass_edit.setText((Encryption().decrypt(
                settings["bestbuy_pass"].encode("utf-8"))).decode("utf-8"))
        except:
            self.bestbuy_pass_edit.setText("")

        try:
            self.target_user_edit.setText(settings["target_user"])
        except:
            self.target_user_edit.setText("")

        try:
            self.target_pass_edit.setText((Encryption().decrypt(
                settings["target_pass"].encode("utf-8"))).decode("utf-8"))
        except:
            self.target_pass_edit.setText("")

        try:
            self.gamestop_user_edit.setText(settings["gamestop_user"])
        except:
            self.gamestop_user_edit.setText("")

        try:
            self.gamestop_pass_edit.setText((Encryption().decrypt(
                settings["gamestop_pass"].encode("utf-8"))).decode("utf-8"))
        except:
            self.gamestop_pass_edit.setText("")

        self.update_settings(settings)
Exemplo n.º 20
0
    return args.parse_args()


def fn_func(true_y, pred_y):
    fn_num = [0] * 3
    assert len(true_y) == len(pred_y), 'error with fn_func.'
    for i in range(len(true_y)):
        if true_y[i] == 0:
            if pred_y[i] != 0:
                fn_num[pred_y[i]-1] += 1
    return fn_num


if __name__ == '__main__':
    FLAGS = parser()
    train_x, train_y, test_x, test_y = return_data(FLAGS.train_path, FLAGS.train_labels,
                                                   FLAGS.test_path, FLAGS.test_labels)
    # svm
    clf_svm = SVC()
    clf_svm.fit(train_x, train_y)
    pred_y_svm = clf_svm.predict(test_x)

    # svm evaluate
    fn_num_svm = fn_func(test_y, pred_y_svm)
    result_svm = np.array(fn_num_svm) / len(test_x) * 100
    print('svm_falseNegative: {0}%, {1}%, {2}%.'.format(result_svm[0], result_svm[1], result_svm[2]))

    # knn
    clf_knn = KNeighborsClassifier(n_neighbors=4)
    clf_knn.fit(train_x, train_y)
    pred_y_knn = clf_knn.predict(test_x)
Exemplo n.º 21
0
 def set_data(self):
     proxies = return_data("./data/proxies.json")
     for proxies_list in proxies:
         list_name = proxies_list["list_name"]
         self.loadlist_box.addItem(list_name)
         self.parent().parent().createdialog.proxies_box.addItem(list_name)
Exemplo n.º 22
0
if argvs[1] == '6':
    submission_folder = argvs[2]
    prepare_moss(submission_folder, '', ['.c'], False, '-for-grading')

    path_to_data = os.path.join(run_folder, 'data')

    os.chdir(run_folder)
    add_missing(submission_folder + '-for-grading', path_to_data)

    os.chdir(run_folder)
    prepare_moss(submission_folder, '', ['.c'], False, '-for-Moss')

if argvs[1] == '7':
    sheet = load_workbook(filename=argvs[2])
    sheet = sheet.active
    data = return_data(sheet, ['A', 'B'], '')
    return_my_sudents(data, argvs[3], argvs[4])

if argvs[1] == '8':
    submission_folder = argvs[2]
    sandbox = argvs[3]
    output_file = argvs[4]
    command = 'make ' + argvs[5]
    check_homework(submission_folder, sandbox, command, output_file)

if argvs[1] == '9':
    source_folder = argvs[2]
    student_list = argvs[3]
    get_students(source_folder, student_list, 'left_to_grade', False)

if argvs[1] == '10':
Exemplo n.º 23
0
 def set_data(self):
     settings = return_data("./data/settings.json")
     self.update_settings(settings)