Пример #1
0
 def UpdateThread_Reciever(self):
     """
     Update Thread reciever
     """
     new_version = self.update_thread.github_version
     update_url = self.update_thread.url
     
     if new_version == 'None':
         return
     
     if new_version != self.version:
         if MsgType.INFO(
             self,
             'elmoCut Update Available',
             'A new version is available.\n'
             f'Do you want to download {new_version}?',
             Buttons.YES | Buttons.NO
         ) == Buttons.YES:
             goto(update_url)
Пример #2
0
class About(QMainWindow, Ui_MainWindow):
    def __init__(self, elmocut, icon):
        super().__init__()
        self.elmocut = elmocut

        # Setup UI
        self.icon = icon
        self.setWindowIcon(icon)
        self.setupUi(self)
        self.setFixedSize(self.size())

        self.social_labels = [
            (self.lblAppIcon,  app_icon,      self.github_app),
            (self.lblFacebook, facebook_icon, self.facebook),
            (self.lblTwitter,  twitter_icon,  self.twitter),
            (self.lblLinkedIn, linkedin_icon, self.linkedin),
            (self.lblGitHub,   github_icon,   self.github)
        ]

        for lbl, icon, url in self.social_labels:
            clickable(lbl).connect(url)
            self.setImage(lbl, icon)

        self.lblAppName.setText(f'elmoCut v{self.elmocut.version}')
        self.lblMyName.setText('Khaled El-Morshedy')
        self.lblNickName.setText('(elmoiv)')
    
    def showEvent(self, event):
        self.setStyleSheet(self.elmocut.styleSheet())
        event.accept()
    
    def setImage(self, label, icon):
        pix = QPixmap()
        pix.loadFromData(icon)
        label.setPixmap(pix)

    facebook   = lambda self: goto('https://www.facebook.com/elmoiv/')
    twitter    = lambda self: goto('https://twitter.com/___xpy___')
    linkedin   = lambda self: goto('https://www.linkedin.com/in/elmoiv/')
    github     = lambda self: goto('https://github.com/elmoiv')
    github_app = lambda self: goto('https://github.com/elmoiv/elmocut')
Пример #3
0
    def __init__(self, elmocut, icon):
        super().__init__()
        self.elmocut = elmocut

        # Setup UI
        self.icon = icon
        self.setWindowIcon(icon)
        self.setupUi(self)
        self.setFixedSize(self.size())

        # Apply old settings on open
        self.currentSettings()

        self.sliderCount.valueChanged.connect(self.spinCount.setValue)
        self.spinCount.valueChanged.connect(self.sliderCount.setValue)
        self.btnApply.clicked.connect(self.Apply)
        self.btnDefaults.clicked.connect(self.Defaults)
        self.btnUpdate.clicked.connect(lambda self: goto('https://github.com/elmoiv/elmocut/releases/latest'))
Пример #4
0
def test_check_variable():
    assert_pos('@var_a100', goto('a100', '@check_variable'))
    assert_pos('@var_b200', goto('b200', '@check_variable'))
    assert_pos('@var_c300', goto('c300', '@check_variable'))
    assert_pos('@def_inner_400', goto('d400', '@check_variable'))
    assert_pos('@OS.get_name', goto('OS.get_name', '@inner_get_name'))

    assert_pos('@def_inner_400', goto('inner', '@return_inner'))

    assert_pos('@lib.foo', goto('foo', '@main_version_body'))
    assert_pos('@lib.bar', goto('lib.bar', '@main_version_body'))
    assert_pos('@lib.test', goto('test_system', '@get_name.test_system'))
    assert_pos('@lib.System.read', goto('SS.read', '@get_name.ss_read'))
    assert_pos('@lib.bar', goto('L2.bar', '@get_name.L2.bar'))

    assert_pos('@OS.get_version',
               goto('self.get_version', '@get_name.get_version'))

    assert_pos('@OS.set_value0', goto('self', '@set_value.self'))
    assert_pos('@OS.set_value0', goto('timeout', '@set_value.timeout'))

    assert goto('wrong_var', '@set_value.wrong_var') is None
Пример #5
0
from assets import app_icon
from utils import goto
from utils_gui import npcap_exists, duplicate_elmocut, repair_settings
from qtools import msg_box, Buttons, MsgIcon

from constants import *

if __name__ == "__main__":
    app = QApplication(argv)
    icon = ElmoCut.processIcon(app_icon)

    # Check if Npcap is installed
    if not npcap_exists():
        if msg_box('elmoCut', 'Npcap is not installed\n\nClick OK to download',
                    MsgIcon.CRITICAL, icon, Buttons.OK | Buttons.CANCEL) == Buttons.OK:
            goto(NPCAP_URL)
    
    # Check if another elmoCut process is running
    elif duplicate_elmocut():
        msg_box('elmoCut', 'elmoCut is already running!', MsgIcon.WARN, icon)
    
    # Run the GUI
    else:
        repair_settings()
        GUI = ElmoCut()
        GUI.show()
        GUI.resizeEvent()
        GUI.scanner.init()
        GUI.scanner.flush_arp()
        GUI.scanEasy()
        GUI.UpdateThread_Starter()