first commit

This commit is contained in:
Xavier 2022-08-24 08:04:54 +02:00
commit 974a5f3294
10 changed files with 1737 additions and 0 deletions

25
README.md Executable file
View File

@ -0,0 +1,25 @@
GUI RKHunter Version 1.01
============================
<img src="http://xavier.debert.free.fr/rkh.png" width="50%">
## Install
pres-requis:
python3
sudo apt-get install python3-tk rkhunter gnome-terminal
sudo ./build.sh
## Run
sudo guirkhunter
## Version en production 1.01
Outils graphique pour simplifier les commandes.
73
Xavier

61
build.sh Executable file
View File

@ -0,0 +1,61 @@
#!/bin/bash
#pres-requis install
if [ -e /usr/bin/python3 ]
then
echo "Phyton installé"
else
echo "Install Python et TK"
apt install python3 -y
fi
if [ -e /usr/share/doc/python3-tk ]
then
echo "Phyton TK installé"
else
echo "Install TK"
apt install python3-tk -y
fi
if [ -e /usr/bin/pip3 ]
then
echo "Phyton pip3 installé"
else
echo "Install pip3"
apt install python3-pip -y
pip3 install cx_Freeze
pip3 install serial
fi
if [ -e /usr/bin/rkhunter ]
then
echo "RKHunter installé"
else
echo "Install RKHunter"
apt install rkhunter -y
fi
if [ -e /usr/bin/gnome-terminal ]
then
echo "gnome-terminal installé"
else
echo "Install gnome-terminal"
apt install gnome-terminal -y
fi
#build and install guiinstall
./setup.py build
cp -r img/ build/exe.linux-x86_64-*/
chmod -R 755 build/
echo "install"
cd build/
rm -r /opt/guirkhunter/
mv exe.linux-x86_64-*/ /opt/guirkhunter/
rm /usr/local/sbin/guirkhunter
ln -s /opt/guirkhunter/main /usr/local/sbin/guirkhunter
exit 0

BIN
icone.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
img/rkh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
img/rkhunter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
img/rkhunter_old.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

164
main.py Executable file
View File

@ -0,0 +1,164 @@
#! /usr/bin/env python3
# -*- coding: UTF-8 -*-
#(c) Xavier 2022
# pour débugger… en ligne de commande !-)
#import pdb; pdb.set_trace()
#GUI RKHunter FRS2013
# for Python3
from tkinter import *
import tkinter.messagebox
import tkinter.filedialog
import os
import serial
import time
import csv
import shutil
import subprocess
try:
import configparser as configparser
except ImportError:
import ConfigParser as configparser
#param os
sysos="linux"
clearscreen="clear"
os.system(clearscreen)
#def function
def Version():
versionrkh = os.popen('rkhunter --version')
tkinter.messagebox.showinfo("Version","GUI RKHunter V" + versionrkh.read() + "\n(C) 2022 Xavier\n1.01")
def Clean():
for c in frame.winfo_children():
c.destroy()
os.system(clearscreen)
FormGUI()
def Rkhscanall():
os.system(clearscreen)
subprocess.call(['gnome-terminal -- bash -c "rkhunter --checkall"',''], shell=True)
def Rkhscanfast():
os.system(clearscreen)
subprocess.call(['gnome-terminal -- bash -c "rkhunter -c --rwo"', ''], shell=True)
def Rkhupdate():
os.system(clearscreen)
subprocess.call(['gnome-terminal -- bash -c "rkhunter --update"',''], shell=True)
def Rkhfix():
subprocess.call(['gnome-terminal -- bash -c "rkhunter --propupd"',''], shell=True)
def Rkhlog():
os.system(clearscreen)
subprocess.call(['gnome-terminal -- bash -c "cat /var/log/rkhunter.log | more"',''], shell=True)
def FormGUI():
for c in frame.winfo_children():
c.destroy()
Label0 = Label(frame, text = 'GUI RKHunter: ')
Label0.grid(column=0,row=0, sticky='w',pady=2)
bouton2= Button (frame, text="RkHunter ScanAll", command=Rkhscanall, padx=2)
bouton2.grid (column=1, row=11,sticky='sw', padx=20)
bouton2= Button (frame, text="RKHunter update", command=Rkhupdate, padx=2)
bouton2.grid (column=10, row=11,sticky='sw', padx=20)
bouton2= Button (frame, text="RkHunter Scan Fast", command=Rkhscanfast, padx=2)
bouton2.grid (column=1, row=31,sticky='sw', padx=20)
bouton2= Button (frame, text="RKHunter Log", command=Rkhlog, padx=2)
bouton2.grid (column=10, row=31,sticky='sw', padx=20)
bouton2= Button (frame, text="RKHunter Fix", command=Rkhfix, padx=2)
bouton2.grid (column=5, row=51,sticky='sw', padx=20)
def FormNoRoot():
tkinter.messagebox.showinfo("Error","GUI RKHunter need ROOT\n")
os._exit(os.EX_OK)
def Quit():
os._exit(os.EX_OK)
def Apropos():
tkinter.messagebox.showinfo("Aide sur GUIRKHunter",
"Ce GUI est un interpréteur de CMD\nScanAll rkhunter --checkall\nSacnFast rkhunter -c --rwo\nUpdate rkhunter --update\nFix rkhunter --propudp\nLog nano /var/log/rkhunter.log\n\n\n")
if __name__ == '__main__':
print("START INI")
chemin = os.popen("readlink guirkhunter | sed 's/main//g'")
# Main window
Mafenetre = Tk()
Mafenetre.title("GUI RKHunter")
if os.name == 'nt':
Mafenetre.iconbitmap("icone.ico")
# Mon logo
logo = PhotoImage(file= "/opt/guirkhunter/img/rkhunter.png")
# Création d'un widget Menu
menubar = Menu(Mafenetre)
menuaide = Menu(menubar,tearoff=0)
if not os.name == 'nt':
menubar.add_cascade(image=logo)
menufichier = Menu(menubar,tearoff=0)
menufichier.add_separator()
menufichier.add_command(label="Nettoyer Frame",command=Clean)
menufichier.add_command(label="Quitter",command=Quit)
menubar.add_cascade(label="Fichier", menu=menufichier)
menuaprs = Menu(menubar,tearoff=0)
menuaprs.add_command(label="RKH Scan All",command=Rkhscanall)
menuaprs.add_command(label="RKH Scan Fast",command=Rkhscanfast)
menuaprs.add_command(label="RKH Update",command=Rkhupdate)
menuaprs.add_command(label="RKH Fix",command=Rkhfix)
menuaprs.add_separator()
menuaprs.add_command(label="RKH Log",command=Rkhlog)
menuaprs.add_separator()
menubar.add_cascade(label="GUI RKHunter", menu=menuaprs)
menuaide = Menu(menubar,tearoff=0)
menuaide.add_command(label="A propos",command=Apropos)
menuaide.add_command(label="Version",command=Version)
menubar.add_cascade(label="Aide", menu=menuaide)
# Affichage du menu
Mafenetre.config(menu=menubar)
frame=Frame(Mafenetre,height=200,width=400)
frame.pack()
Canevas = Canvas(Mafenetre,width=400, height=5)
Canevas.pack()
frame.photo = PhotoImage(file ='')
espace_image = Canvas(frame, width =170, height =170, bg ='black')
espace_image.grid(row=3 ,columnspan=2, column=0, padx =10, pady =10)
espace_image.create_image(85, 85, image =frame.photo)
if os.getuid() != 0:
# We're not root so, like, whatever dude
print("No root")
FormNoRoot();
FormGUI()
Mafenetre.mainloop()

34
rkhunter Normal file
View File

@ -0,0 +1,34 @@
# Defaults for rkhunter automatic tasks
# sourced by /etc/cron.*/rkhunter and /etc/apt/apt.conf.d/90rkhunter
#
# This is a POSIX shell fragment
#
# Set this to yes to enable rkhunter daily runs
# (default: false)
CRON_DAILY_RUN="true"
# Set this to yes to enable rkhunter weekly database updates
# (default: false)
CRON_DB_UPDATE="true"
# Set this to yes to enable reports of weekly database updates
# (default: false)
DB_UPDATE_EMAIL="false"
# Set this to the email address where reports and run output should be sent
# (default: root)
REPORT_EMAIL="root"
# Set this to yes to enable automatic database updates
# (default: false)
APT_AUTOGEN="true"
# Nicenesses range from -20 (most favorable scheduling) to 19 (least favorable)
# (default: 0)
NICE="0"
# Should daily check be run when running on battery
# powermgmt-base is required to detect if running on battery or on AC power
# (default: false)
RUN_CHECK_ON_BATTERY="false"

1352
rkhunter.conf Normal file

File diff suppressed because it is too large Load Diff

101
setup.py Executable file
View File

@ -0,0 +1,101 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Python 3
#(c) Xavier 2019
"""
Icone sous Windows: il faut:
=> un xxx.ico pour integration dans le exe, avec "icon=xxx.ico"
=> un xxx.png pour integration avec PyQt4 + demander la recopie avec includefiles.
"""
import sys, os
from cx_Freeze import setup, Executable
#############################################################################
# preparation des options
# chemins de recherche des modules
# ajouter d'autres chemins (absolus) si necessaire: sys.path + ["chemin1", "chemin2"]
path = sys.path
# options d'inclusion/exclusion des modules
includes = [] # nommer les modules non trouves par cx_freeze
excludes = []
packages = [] # nommer les packages utilises
# copier les fichiers non-Python et/ou repertoires et leur contenu:
includefiles = []
if sys.platform == "win32":
pass
# includefiles += [...] : ajouter les recopies specifiques à Windows
elif sys.platform == "linux2":
pass
# includefiles += [...] : ajouter les recopies specifiques à Linux
else:
pass
# includefiles += [...] : cas du Mac OSX non traite ici
# pour que les bibliotheques binaires de /usr/lib soient recopiees aussi sous Linux
binpathincludes = []
if sys.platform == "linux2":
binpathincludes += ["/usr/lib"]
# niveau d'optimisation pour la compilation en bytecodes
optimize = 0
# si True, n'affiche que les warning et les erreurs pendant le traitement cx_freeze
silent = True
# construction du dictionnaire des options
options = {"path": path,
"includes": includes,
"excludes": excludes,
"packages": packages,
"include_files": includefiles,
"bin_path_includes": binpathincludes,
#"create_shared_zip": False, # <= ne pas generer de fichier zip
#"include_in_shared_zip": False, # <= ne pas generer de fichier zip
#"compressed": False, # <= ne pas generer de fichier zip
"optimize": optimize,
"silent": silent
}
# pour inclure sous Windows les dll system de Windows necessaires
if sys.platform == "win32":
options["include_msvcr"] = True
#############################################################################
# preparation des cibles
base = None
if sys.platform == "win32":
base = "Win32GUI" # pour application graphique sous Windows
# base = "Console" # pour application en console sous Windows
icone = "icone.ico"
if sys.platform == "win32":
icone = "icone.ico"
cible_1 = Executable(
script="main.py",
base=base,
#compress=False, # <= ne pas generer de fichier zip
#copyDependentFiles=True,
#appendScriptToExe=True,
#appendScriptToLibrary=False, # <= ne pas generer de fichier zip
icon="icone.ico"
)
#############################################################################
# creation du setup
setup(
name="GUI RKHunter",
version="1.01",
description="GUI RKHunter",
author="FRS2013",
options={"build_exe": options},
executables=[cible_1]
)