Skip to content

Commit

Permalink
[UPDATE] about to start window client developpement. Checks are finis…
Browse files Browse the repository at this point in the history
…hed. Need to verify if launch child process have same admin rights
  • Loading branch information
Just1truc committed Jul 24, 2022
1 parent 59a9e7a commit 61ad342
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 34 deletions.
Empty file.
35 changes: 35 additions & 0 deletions windows_client/one_time_windows_client.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
:: Hiding commands
@echo off

python --version 3>NUL
if errorlevel 1 goto errorNoPython

:: Install dependencies
echo [Argos] Installing dependencies
python -m pip install --upgrade pip > NUL && pip install -r %~dp0/dependencies > NUL
echo [Argos] Starting argos...

:: Check if script is indeed runned as administrator.
net session >nul 2>&1
if %errorLevel% == 0 (
echo [Argos] Success: Administrative permissions confirmed.
) else (
powershell -Command "& {Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.MessageBox]::Show('[Argos] Failure: Current permissions inadequate. The script must be run with admin rights', 'Argos', 'ok', [System.Windows.Forms.MessageBoxIcon]::Error);}" > NUL
echo [Argos] Failure: Current permissions inadequate.
goto:exit
)

:: Start argos
chdir %~dp0
python3 %~dp0/windows_client.py
::pause

::Exiting script before error print
:exit
goto:eof

:: Print error
:errorNoPython
echo.
echo Error^: Python not installed
"C:\Program Files\used\systems\innoventiq\accumanager\required\excutables\python-3.7.3-amd64.exe"
Binary file not shown.
73 changes: 39 additions & 34 deletions windows_client/src/askers.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,57 @@
import tkinter, PIL
import winsound
from tkinter import *
from tkinter import ttk
from tkinter.ttk import Style
from tkinter.messagebox import *
from turtle import color
from PIL import ImageTk, Image
import validators
import os
from src.server import start_server

from cairo import FontWeight
def destroy_win():
window.destroy()

def showPassword():
password = entry_point.get()
username = username_entry_point.get()
url = url_entry_point.get()
print(url)
print('checking')
if (validators.url(url) != True):
showerror('Oops', 'Url is invalid')
return

WARNING_TEXT = f'Argos will give total access to you computer to the person possesing the server at the url : {url}. The commands that are run could badly damage your computer.'

# Destroying old url label

url_entry_point.destroy()
url_label.destroy()
button.destroy()

# Setting up new window

protection_alert = Label(master=frame, text="WARNING", fg="yellow", bg="#202020", font=('Roboto', '11', 'bold'))
protection_alert.grid(row=2, pady=5, padx=INSIDE_PADDING)

warning_text = Text(master=frame, fg="white", bg="#202020", font=('Roboto', '11', 'bold'), wrap=WORD, borderwidth=0, width=30, height=6)
warning_text.insert(END, WARNING_TEXT)
warning_text.grid(row=3, pady=5, padx=INSIDE_PADDING)

## Setting up new validate or refuse button

inside_frame = Frame(master=frame, relief= 'sunken', bg="#202020")
inside_frame.grid(row = 4, column = 0, pady = (30, 20 + BLOCK_PADDING))

cancel_button = Button(master=inside_frame, bg="red", fg="#333333", text="Cancel", borderwidth=0, cursor="hand2", font=('Roboto', '11', 'bold'), command=destroy_win)
cancel_button.grid(row=0, column=0, ipadx = 10, ipady = 5, padx=5)

validate_button = Button(master=inside_frame, bg="lightgreen", fg="#333333", text="Accept", borderwidth=0, cursor="hand2", font=('Roboto', '11', 'bold'), command=start_server)
validate_button.grid(column=1, row = 0, ipadx = 10, ipady = 5, padx=5)

def askInfoWindow( Verify):

global entry_point, username_entry_point, url_entry_point
global window
global url_entry_point
global window, frame, url_label, url_entry_point, INSIDE_PADDING, button, BLOCK_PADDING

INSIDE_PADDING=50

Expand All @@ -32,8 +60,9 @@ def askInfoWindow( Verify):
# Init window
window = Tk()
window.title("Argos")
window.tk.call('wm', 'iconphoto', window._w, PhotoImage(file=f'../assets/ARG.png'))

img = ImageTk.PhotoImage(Image.open('./assets/ARG.png').resize((100,100)))
img = ImageTk.PhotoImage(Image.open(f'../assets/ARG.png').resize((100,100)))

# frames
frame = Frame(window, bg="#202020", relief= 'sunken')
Expand All @@ -43,43 +72,19 @@ def askInfoWindow( Verify):

img_label = Label(frame, image=img, bg="#202020").grid(row=0, pady=(BLOCK_PADDING,0))

username_title_label = Label(frame, text="Admin username", fg="white", bg="#202020", font=('Roboto', '11', 'bold'))

username_title_label.grid(row=1, column=0, padx=INSIDE_PADDING, pady=10, sticky=W)

username_info = ""
username_entry_point = Entry(frame, textvariable=username_info, bg ='#333333', fg='white', insertbackground="white", validate="none", selectborderwidth=0, borderwidth=10, relief=FLAT)

username_entry_point.grid(row = 2, column = 0, padx=INSIDE_PADDING)

username_entry_point.focus_set()

title_label = Label(frame, text="Admin password", fg="white", bg="#202020", font=('Roboto', '11', 'bold'))

title_label.grid(row=3, column=0, padx=INSIDE_PADDING, pady=10, sticky=W)

info = ""
entry_point = Entry(frame, textvariable=info, show='*', bg ='#333333', fg='white', insertbackground="white", validate="none", selectborderwidth=0, borderwidth=10, relief=FLAT)

entry_point.grid(row = 4, column = 0, padx=INSIDE_PADDING)

entry_point.focus_set()

url_label = Label(frame, text="Server Url", fg="white", bg="#202020", font=('Roboto', '11', 'bold'))

url_label.grid(row=5, column=0, padx=INSIDE_PADDING, pady=10, sticky=W)
url_label.grid(row=2, column=0, padx=INSIDE_PADDING, pady=5, sticky=W)

url = ""
url_entry_point = Entry(frame, textvariable=url, bg ='#333333', fg='white', insertbackground="white", validate="none", selectborderwidth=0, borderwidth=10, relief=FLAT)

url_entry_point.grid(row = 6, column = 0, padx=INSIDE_PADDING)
url_entry_point.grid(row = 3, column = 0, padx=INSIDE_PADDING)

# Validate Button

button = Button(frame, text='Validate', command = Verify, bg="lightgreen", borderwidth=0, cursor="hand2", font=('Roboto', '11', 'bold'))
button.grid(row = 7, column = 0, ipadx = 10, ipady = 5, pady = (30, 20 + BLOCK_PADDING))
button.grid(row = 4, column = 0, ipadx = 10, ipady = 5, pady = (30, 20 + BLOCK_PADDING))

window.mainloop()

askInfoWindow(Verify=showPassword)

5 changes: 5 additions & 0 deletions windows_client/src/server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

import socketio

def start_server():
print("Starting server...")
4 changes: 4 additions & 0 deletions windows_client/windows_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from src.askers import *

print("[Argos] Launched")
askInfoWindow(Verify=showPassword)

0 comments on commit 61ad342

Please sign in to comment.