Kaydet (Commit) d725a28c authored tarafından bayram karahan's avatar bayram karahan

Initial commit

üst
QMAKE_CXX.INCDIRS = \
/usr/include/c++/8 \
/usr/include/x86_64-linux-gnu/c++/8 \
/usr/include/c++/8/backward \
/usr/lib/gcc/x86_64-linux-gnu/8/include \
/usr/local/include \
/usr/lib/gcc/x86_64-linux-gnu/8/include-fixed \
/usr/include/x86_64-linux-gnu \
/usr/include
QMAKE_CXX.LIBDIRS = \
/usr/lib/gcc/x86_64-linux-gnu/8 \
/usr/lib/x86_64-linux-gnu \
/usr/lib \
/lib/x86_64-linux-gnu \
/lib
QMAKE_CXX.QT_COMPILER_STDCXX = 201402L
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 8
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 3
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
QMAKE_CXX.COMPILER_MACROS = \
QT_COMPILER_STDCXX \
QMAKE_GCC_MAJOR_VERSION \
QMAKE_GCC_MINOR_VERSION \
QMAKE_GCC_PATCH_VERSION
This diff is collapsed.
#ifndef CLIENT_H
#define CLIENT_H
#include <QTcpSocket>
#include<filecrud.h>
#include <QDataStream>
#include<QTimer>
#include<QUdpSocket>
#include<QNetworkInterface>
#include<QProcess>
class IpMac
{
public:
QString ip;
QString mac;
QString broadcast;
QString subnet;
};
class Client
{
//Q_OBJECT
public:
Client();
~Client();
signals:
public slots:
QStringList listRemove(QStringList list,QString data);
QStringList fileToList(QString path,QString filename);
void listToFile(QString path,QStringList list, QString filename);
QString listGetLine(QStringList list,QString data);
QString getIpPortStatus(QString service);
void tcpMesajSendTimerSlot();
void komutSudoExpect(QString komut,QString username,QString password);
private slots:
void commandExecuteSlot(QString command,QString username,QString password);
void udpSocketGetRead();
void udpSocketSendTServer(QString _data);
void timerControlSlot();
void hostAddressMacButtonSlot();
void webBlockAktifPasif();
//QString getIpPort///Status(QString ip_,QString prt);
private:
bool webblockstate;
QString rootusername;
QString rootpassword;
QProcess process;
QTimer *timer;
QTimer *timerControl;
//QTcpSocket* socket;
// QString myIpAddress;
//QString myMacAddress;
QList<IpMac> ipmaclist;
QString localDir;
QString localDir1;
QString ip;
QString tcpPort;
QUdpSocket *udpSocketSend = nullptr;
QUdpSocket *udpSocketGet = nullptr;
};
#endif // CLIENT_H
a164129736096c384ddedcb5e00f6a3ec584cd15
\ No newline at end of file
Package: e-ag-client-dbgsym
Source: e-ag-client
Version: 1.9.0
Auto-Built-Package: debug-symbols
Architecture: amd64
Maintainer: Bayram KARAHAN <bayramk@gmail.com>
Installed-Size: 520
Depends: e-ag-client (= 1.9.0)
Section: debug
Priority: optional
Description: debug symbols for e-ag-client
Build-Ids: a164129736096c384ddedcb5e00f6a3ec584cd15
7e3252c59b07cbf94bdc4262ece7eba1 usr/lib/debug/.build-id/a1/64129736096c384ddedcb5e00f6a3ec584cd15.debug
e-ag-client (1.9.0) unstable; urgency=medium
* Initial Release
-- Bayram KARAHAN <bayramk@gmail.com> Sun, 27 Dec 2020 14:31:08 +0300
Source: e-ag-client
Section: utils
Priority: optional
Maintainer: Bayram KARAHAN <bayramk@gmail.com>
Build-Depends: debhelper (>= 9),
libc6,
libgcc1,
libgcc-8-dev,
libgl1-mesa-glx | libgl1,
libqt5core5a,
libqt5gui5,
libqt5network5,
libqt5qml5,
libqt5quick5,
libqt5svg5-dev,
libqt5widgets5,
libstdc++6,
qtdeclarative5-dev
Standards-Version: 3.9.8
Homepage: http://pardus.org.tr
Package: e-ag-client
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends},
libqt5xml5,
libqt5core5a,
libqt5gui5,
libqt5network5,
libqt5qml5,
libqt5quick5,
libqt5svg5-dev,
libqt5widgets5,
libstdc++6,
xdotool,
libqt5widgets5,
openssh-server,
sshpass,
rdesktop,
x11vnc,
vsftpd,
xtightvncviewer,
net-tools,
expect,
xrdp,
ethtool
Description: E-Ag İsteci Konsol Uygulaması
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: e-ag-client
Source: https://github.com/bayramkarahan/e-ag-x11client
Files: *
Copyright: 2020 Bayram KARAHAN <bayramk@gmail.com>
License: GPL-3.0+
License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
dh_update_autotools_config
dh_auto_configure
dh_auto_build
dh_auto_test
dh_prep
dh_auto_install
dh_installdocs
dh_installchangelogs
dh_perl
dh_link
dh_strip_nondeterminism
dh_compress
dh_fixperms
dh_missing
dh_strip
dh_makeshlibs
override_dh_shlibdeps dh_shlibdeps
dh_shlibdeps
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
shlibs:Depends=libc6 (>= 2.14), libgcc1 (>= 1:3.0), libqt5core5a (>= 5.11.0~rc1), libqt5network5 (>= 5.11.0~rc1), libstdc++6 (>= 5.2)
misc:Depends=
misc:Pre-Depends=
Package: e-ag-client
Version: 1.9.0
Architecture: amd64
Maintainer: Bayram KARAHAN <bayramk@gmail.com>
Installed-Size: 107
Depends: libc6 (>= 2.14), libgcc1 (>= 1:3.0), libqt5core5a (>= 5.11.0~rc1), libqt5network5 (>= 5.11.0~rc1), libstdc++6 (>= 5.2), libqt5xml5, libqt5gui5, libqt5qml5, libqt5quick5, libqt5svg5-dev, libqt5widgets5, xdotool, openssh-server, sshpass, rdesktop, x11vnc, vsftpd, xtightvncviewer, net-tools, expect, xrdp, ethtool
Section: utils
Priority: optional
Homepage: http://pardus.org.tr
Description: E-Ag İsteci Konsol Uygulaması
b4a1579e25c6436fbfc7d0cd87e06957 lib/systemd/system/e-ag-client.service
4d335495b2c270e5df654af6c46a08a7 lib/systemd/system/e-ag-x11vncdesktop.service
3d68f15b88738d7edb0e0225c9c07306 lib/systemd/system/e-ag-x11vnclogin.service
063e74deca0a35f528bab80c2f2931d9 usr/bin/e-ag-client
61dca7439ddca0fa444624e5ce24f5a6 usr/bin/e-ag-run.sh
d2d7ec3164d50f18eea4b7c8c3257225 usr/bin/x11vncpasswd
e0082a14fa9ddcaae50bb7bd56757862 usr/share/doc/e-ag-client/changelog.gz
8f0e24f763e519ea62b036235aca62e0 usr/share/doc/e-ag-client/copyright
810d71067df9a3fcd8a13a6805dca150 usr/share/e-ag/webdisable.sh
#!/bin/sh
sed -i 's/#WaylandEnable=false/WaylandEnable=false/' /etc/gdm3/daemon.conf
sed -i 's/WaylandEnable=false/WaylandEnable=false/' /etc/gdm3/daemon.conf
sed -i 's/#WaylandEnable=true/WaylandEnable=false/' /etc/gdm3/daemon.conf
sed -i 's/WaylandEnable=true/WaylandEnable=false/' /etc/gdm3/daemon.conf
sed -i 's/AutomaticLogin=ogrenci/#AutomaticLogin=ogrenci/' /etc/gdm3/daemon.conf
sed -i 's/#AutomaticLogin=ogrenci/#AutomaticLogin=ogrenci/' /etc/gdm3/daemon.conf
mkdir /usr/share/e-ag
chmod 777 /usr/share/e-ag
systemctl daemon-reload
systemctl enable e-ag-client.service
systemctl start e-ag-client.service
#systemctl enable ssh.service
#systemctl start ssh.service
#systemctl enable vsftpd.service
#systemctl start vsftpd.service
systemctl enable e-ag-x11vnclogin.service
systemctl start e-ag-x11vnclogin.service
systemctl enable e-ag-x11vncdesktop.service
systemctl start e-ag-x11vncdesktop.service
exit 0
#!/bin/sh
systemctl disable e-ag-client.service
systemctl stop e-ag-client.service
#systemctl disable ssh.service
#systemctl stop ssh.service
#systemctl disable vsftpd.service
#systemctl stop vsftpd.service
systemctl disable e-ag-x11vncdesktop.service
systemctl stop e-ag-x11vncdesktop.service
systemctl disable e-ag-x11vnclogin.service
systemctl stop e-ag-x11vnclogin.service
systemctl daemon-reload
#rm -rf /usr/share/e-ag
#chmod 777 /usr/share/e-ag
exit 0
[Unit]
Description=e-agClient Başlatıldı.
After=multi-user.target
[Service]
Type=simple
#Environment=export DISPLAY=:0
ExecStart=/usr/bin/e-ag-client 1>/usr/share/e-ag/Client.log 2>ClientError.log
[Install]
WantedBy=multi-user.target
[Unit]
Description=Start x11vnc at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /usr/bin/x11vncpasswd -rfbport 5900 -shared
[Install]
WantedBy=multi-user.target
[Unit]
Description=Start x11vnclogin at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth /run/user/115/gdm/Xauthority -forever -loop -noxdamage -repeat -rfbauth /usr/bin/x11vncpasswd -rfbport 5902 -shared -display :0
[Install]
WantedBy=multi-user.target
#!/bin/bash
myuser=""
mydisplay=""
##myuser=$(cat /run/systemd/sessions/$(loginctl list-sessions|grep "seat"|awk '{print $1}')|grep "USER"|awk -F '=' '{print $2}')
##mydisplay=$(cat /run/systemd/sessions/$(loginctl list-sessions|grep "seat"|awk '{print $1}')|grep "DISPLAY"|awk -F '=:' '{print $2}')
for ids in $(loginctl list-sessions|grep "seat" | awk '{print $1}')
do
status=$(loginctl show-session -p Display -p Active $ids|awk '$1 ~ /Active=yes/ { print $ids}')
if [ "$status" = "Active=yes" ]; then
myuser=$(cat /run/systemd/sessions/"$ids"|grep "USER")
mydisplay=$(cat /run/systemd/sessions/"$ids"|grep "DISPLAY"|tail -1)
mydesktopmanager=$(cat /run/systemd/sessions/"$ids"|grep "SERVICE"|tail -1)
#myuser=$(loginctl list-sessions|awk -v idss="$ids" '$1 == idss {print $3}')
#mydisplay=$(loginctl show-session -p Display -p Active $ids|awk '$1 ~ /Display=/ { print $1}')
fi
done
# : karekteri siliniyor
myuser=$(echo "$myuser"| tr -d ':')
mydisplay=$(echo "$mydisplay"| tr -d ':')
mydesktopmanager=$(echo "$mydesktopmanager"| tr -d ':')
# = karekterinden sonraki sütun alınıyor
myuser=$(echo "$myuser"|awk -F '=' '{print $2}')
mydisplay=$(echo "$mydisplay"| awk -F '=' '{print $2}')
mydesktopmanager=$(echo "$mydesktopmanager"| awk -F '=' '{print $2}')
myid=$(id -u $myuser)
version=$(uname -a|awk '{print $3}'|cut -c1-1) #3.16=>3 4.19=>4 vb.
proje=$(uname -a|awk '{print $2}') #etap pardus vb.
echo "myenv|$myuser|$mydisplay|$myid|$proje$version|$mydesktopmanager" > /tmp/myenv
#echo $mydisplay
pv=$(echo "$proje$version")
if [ "$pv" = "etap3" ]; then
cp /home/$myuser/.Xauthority /root
chown root:root /root/.Xauthority
fi
if [ "$pv" = "etap4" ]; then
if [ "$myuser" = "Debian-gdm" ]; then
cp /run/user/$myuser/.Xauthority /root
chown root:root /root/.Xauthority
else
cp /home/$myuser/.Xauthority /root
chown root:root /root/.Xauthority
fi
fi
if [ "$pv" = "pardus4" ]; then
if [ "$myuser" = "lightdm" ]; then
cp /var/lib/lightdm/.Xauthority /root
chown root:root /root/.Xauthority
else
cp /home/$myuser/.Xauthority /root
chown root:root /root/.Xauthority
fi
fi
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: e-ag-client
Source: https://github.com/bayramkarahan/e-ag-x11client
Files: *
Copyright: 2020 Bayram KARAHAN <bayramk@gmail.com>
License: GPL-3.0+
License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
#!/bin/bash
sudo iptables -F
for entry in $(cat /usr/share/e-ag/webblocklist)
do
# echo "$entry"
sudo iptables -A OUTPUT -p tcp -m string --string "$entry" --algo kmp -j REJECT
done
e-ag-client-dbgsym_1.9.0_amd64.deb debug optional automatic=yes
e-ag-client_1.9.0_amd64.buildinfo utils optional
e-ag-client_1.9.0_amd64.deb utils optional
#!/bin/sh
sed -i 's/#WaylandEnable=false/WaylandEnable=false/' /etc/gdm3/daemon.conf
sed -i 's/WaylandEnable=false/WaylandEnable=false/' /etc/gdm3/daemon.conf
sed -i 's/#WaylandEnable=true/WaylandEnable=false/' /etc/gdm3/daemon.conf
sed -i 's/WaylandEnable=true/WaylandEnable=false/' /etc/gdm3/daemon.conf
sed -i 's/AutomaticLogin=ogrenci/#AutomaticLogin=ogrenci/' /etc/gdm3/daemon.conf
sed -i 's/#AutomaticLogin=ogrenci/#AutomaticLogin=ogrenci/' /etc/gdm3/daemon.conf
mkdir /usr/share/e-ag
chmod 777 /usr/share/e-ag
systemctl daemon-reload
systemctl enable e-ag-client.service
systemctl start e-ag-client.service
#systemctl enable ssh.service
#systemctl start ssh.service
#systemctl enable vsftpd.service
#systemctl start vsftpd.service
systemctl enable e-ag-x11vnclogin.service
systemctl start e-ag-x11vnclogin.service
systemctl enable e-ag-x11vncdesktop.service
systemctl start e-ag-x11vncdesktop.service
exit 0
#!/bin/sh
systemctl disable e-ag-client.service
systemctl stop e-ag-client.service
#systemctl disable ssh.service
#systemctl stop ssh.service
#systemctl disable vsftpd.service
#systemctl stop vsftpd.service
systemctl disable e-ag-x11vncdesktop.service
systemctl stop e-ag-x11vncdesktop.service
systemctl disable e-ag-x11vnclogin.service
systemctl stop e-ag-x11vnclogin.service
systemctl daemon-reload
#rm -rf /usr/share/e-ag
#chmod 777 /usr/share/e-ag
exit 0
#!/usr/bin/make -f
export QT_SELECT := qt5
%:
dh $@
override_dh_shlibdeps:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
QT -= gui
QT += network core
CONFIG += c++11 console
CONFIG -= app_bundle
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
TARGET = e-ag-client
TEMPLATE = app
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
client.cpp \
singleinstance.cpp
HEADERS += \
client.h \
filecrud.h \
singleinstance.h
target.path = /usr/bin
service.files = e-ag-client.service
service.path = /lib/systemd/system/
x11servicedesktop.files = e-ag-x11vncdesktop.service
x11servicedesktop.path = /lib/systemd/system/
x11servicelogin.files = e-ag-x11vnclogin.service
x11servicelogin.path = /lib/systemd/system/
x11passwd.files = x11vncpasswd
x11passwd.path = /usr/bin/
runfile.files = e-ag-run.sh
runfile.path = /usr/bin/
webdisablefile.files = webdisable.sh
webdisablefile.path = /usr/share/e-ag/
INSTALLS += target service x11servicedesktop x11servicelogin x11passwd runfile webdisablefile
DISTFILES += \
e-ag-client.service\
e-ag-x11vncdesktop.service\
e-ag-x11vnclogin.service\
x11vncpasswd\
e-ag-run.sh\
webdisable.sh
[Unit]
Description=e-agClient Başlatıldı.
After=multi-user.target
[Service]
Type=simple
#Environment=export DISPLAY=:0
ExecStart=/usr/bin/e-ag-client 1>/usr/share/e-ag/Client.log 2>ClientError.log
[Install]
WantedBy=multi-user.target
#!/bin/bash
myuser=""
mydisplay=""
##myuser=$(cat /run/systemd/sessions/$(loginctl list-sessions|grep "seat"|awk '{print $1}')|grep "USER"|awk -F '=' '{print $2}')
##mydisplay=$(cat /run/systemd/sessions/$(loginctl list-sessions|grep "seat"|awk '{print $1}')|grep "DISPLAY"|awk -F '=:' '{print $2}')
for ids in $(loginctl list-sessions|grep "seat" | awk '{print $1}')
do
status=$(loginctl show-session -p Display -p Active $ids|awk '$1 ~ /Active=yes/ { print $ids}')
if [ "$status" = "Active=yes" ]; then
myuser=$(cat /run/systemd/sessions/"$ids"|grep "USER")
mydisplay=$(cat /run/systemd/sessions/"$ids"|grep "DISPLAY"|tail -1)
mydesktopmanager=$(cat /run/systemd/sessions/"$ids"|grep "SERVICE"|tail -1)
#myuser=$(loginctl list-sessions|awk -v idss="$ids" '$1 == idss {print $3}')
#mydisplay=$(loginctl show-session -p Display -p Active $ids|awk '$1 ~ /Display=/ { print $1}')
fi
done
# : karekteri siliniyor
myuser=$(echo "$myuser"| tr -d ':')
mydisplay=$(echo "$mydisplay"| tr -d ':')
mydesktopmanager=$(echo "$mydesktopmanager"| tr -d ':')
# = karekterinden sonraki sütun alınıyor
myuser=$(echo "$myuser"|awk -F '=' '{print $2}')
mydisplay=$(echo "$mydisplay"| awk -F '=' '{print $2}')
mydesktopmanager=$(echo "$mydesktopmanager"| awk -F '=' '{print $2}')
myid=$(id -u $myuser)
version=$(uname -a|awk '{print $3}'|cut -c1-1) #3.16=>3 4.19=>4 vb.
proje=$(uname -a|awk '{print $2}') #etap pardus vb.
echo "myenv|$myuser|$mydisplay|$myid|$proje$version|$mydesktopmanager" > /tmp/myenv
#echo $mydisplay
pv=$(echo "$proje$version")
if [ "$pv" = "etap3" ]; then
cp /home/$myuser/.Xauthority /root
chown root:root /root/.Xauthority
fi
if [ "$pv" = "etap4" ]; then
if [ "$myuser" = "Debian-gdm" ]; then
cp /run/user/$myuser/.Xauthority /root
chown root:root /root/.Xauthority
else
cp /home/$myuser/.Xauthority /root
chown root:root /root/.Xauthority
fi
fi
if [ "$pv" = "pardus4" ]; then
if [ "$myuser" = "lightdm" ]; then
cp /var/lib/lightdm/.Xauthority /root
chown root:root /root/.Xauthority
else
cp /home/$myuser/.Xauthority /root
chown root:root /root/.Xauthority
fi
fi
[Unit]
Description=Start x11vnc at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth guess -forever -loop -noxdamage -repeat -rfbauth /usr/bin/x11vncpasswd -rfbport 5900 -shared
[Install]
WantedBy=multi-user.target
[Unit]
Description=Start x11vnclogin at startup.
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -auth /run/user/115/gdm/Xauthority -forever -loop -noxdamage -repeat -rfbauth /usr/bin/x11vncpasswd -rfbport 5902 -shared -display :0
[Install]
WantedBy=multi-user.target
#ifndef FILECRUD_H
#define FILECRUD_H
#include<QFile>
#include<QDir>
#include <QRegularExpression>
class FileCrud
{
public:
QString dosya;//FileCrud *fc=new FileCrud();
void fileRemove()
{
QFile file(dosya);
file.remove();
}
bool fileExists()
{
QFile file(dosya);
if(file.exists()) return true; else return false;
}
void fileWrite(QString veri)
{
QFile data(dosya);
QFile newData(dosya);
data.open(QIODevice::Text | QIODevice::ReadWrite);
QString dataText = data.readAll();
dataText.append(veri+"\n");
if(newData.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&newData);
out << dataText;
}
newData.close();
data.close();
}
void fileRead()
{
QFile file(dosya);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text | QIODevice::ReadWrite))
{
qDebug() << "FAIL TO CREATE FILE / FILE NOT EXIT***";
}
while (!file.atEnd()) {
QByteArray line = file.readLine();
}
}
int fileCount()
{
QFile file(dosya);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text | QIODevice::ReadWrite))
{
qDebug() << "FAIL TO CREATE FILE / FILE NOT EXIT***";
}
int sayi=0;
while (!file.atEnd()) {
QByteArray line = file.readLine();
sayi++;
}
file.close();
return sayi;
}
void fileDelete(QString data)
{
QRegularExpression re(data);
QFile f(dosya);
if(f.open(QIODevice::ReadWrite | QIODevice::Text))
{
QString s;
QTextStream t(&f);
while(!t.atEnd())
{
QString line = t.readLine();
if(!line.contains(re))
s.append(line + "\n");
}
f.resize(0);
t << s;
f.close();
}
}
QString fileSearch(QString data)
{
QString rdata;
QFile file(dosya);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text | QIODevice::ReadWrite))
{
qDebug() << "FAIL TO CREATE FILE / FILE NOT EXIT***";
}
QRegularExpression re(data);
while (!file.atEnd()) {
QString line = file.readLine();
if(line.contains(re)) rdata=line; //qDebug()<<"bulundu......";
}
return rdata;
}
QString fileGetLine(int recordLineNumber)
{
QString rdata;
QFile file(dosya);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text | QIODevice::ReadWrite))
{
qDebug() << "FAIL TO CREATE FILE / FILE NOT EXIT***";
}
int sira=0;
while (!file.atEnd()) {
QString line = file.readLine();
if(sira==recordLineNumber-1) rdata=line; //qDebug()<<"bulundu......";
sira++;
}
file.close();
return rdata;
}
void fileDeletet(QString delveri)
{
QFile data(dosya);
QFile newData(dosya);
data.open(QIODevice::Text | QIODevice::ReadOnly);
QString dataText = data.readAll();
QRegularExpression re(delveri);
QString replacementText("");
dataText.replace(re, replacementText);
if(newData.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&newData);
out << dataText;
}
newData.close();
}
void fileEdit(QString oldveri,QString newveri)
{
QFile data(dosya);
QFile newData(dosya);
data.open(QIODevice::Text | QIODevice::ReadOnly);
QString dataText = data.readAll();
QRegularExpression re(oldveri);
QString replacementText(newveri);
dataText.replace(re, replacementText);
if(newData.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&newData);
out << dataText;
}
newData.close();
}
};
#endif // FILECRUD_H
#include <QCoreApplication>
#include<client.h>
#include <QString>
#include <QDir>
#include<QDebug>
#include<singleinstance.h>
#define SINGLE_INSTANCE ".Client"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QString name = SINGLE_INSTANCE;
SingleInstance cInstance;
if(cInstance.hasPrevious(name, QCoreApplication::arguments()))
{
qDebug() << "Client Zaten Açık...";
return 0;
}
if (cInstance.listen(name)) {
qDebug() << "Client Çalışıyor..";
} else {
qDebug() << "Client Çalışması İptal Edildi...";
return 0;
}
Client *cl=new Client();
return a.exec();
}
/*****************************************************************************
* Copyright (C) 2016 by Yunusemre Senturk *
* <yunusemre.senturk@pardus.org.tr> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*****************************************************************************/
#include "singleinstance.h"
SingleInstance::SingleInstance(QObject *parent) : QObject(parent)
{
connect(&mServer, SIGNAL(newConnection()),this,SLOT(newConnection()));
}
SingleInstance::~SingleInstance()
{
}
bool SingleInstance::listen(QString name)
{
mServer.removeServer(name);
return mServer.listen(name);
}
bool SingleInstance::hasPrevious(QString name, QStringList arg)
{
qDebug() << "Checking for previous instance...";
QLocalSocket socket;
socket.connectToServer(name, QLocalSocket::ReadWrite);
if(socket.waitForConnected())
{
qDebug() << "Sending args to previous instance...";
QByteArray buffer;
foreach(QString item, arg)
{
buffer.append(item + "\n");
}
socket.write(buffer);
socket.waitForBytesWritten();
return true;
}
qDebug() << socket.errorString();
return false;
}
void SingleInstance::newConnection()
{
emit newInstance();
mSocket = mServer.nextPendingConnection();
connect(mSocket,SIGNAL(readyRead()),this,SLOT(readyRead()));
}
void SingleInstance::readyRead()
{
mSocket->deleteLater();
}
/*****************************************************************************
* Copyright (C) 2016 by Yunusemre Senturk *
* <yunusemre.senturk@pardus.org.tr> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
*****************************************************************************/
#ifndef SINGLEINSTANCE_H
#define SINGLEINSTANCE_H
#include <QObject>
#include <QDebug>
#include <QLocalServer>
#include <QLocalSocket>
class SingleInstance : public QObject
{
Q_OBJECT
public:
explicit SingleInstance(QObject *parent = 0);
~SingleInstance();
bool listen(QString name);
bool hasPrevious(QString name, QStringList arg);
signals:
void newInstance();
public slots:
void newConnection();
void readyRead();
private:
QLocalSocket* mSocket;
QLocalServer mServer;
};
#endif // SINGLEINSTANCE_H
#!/bin/bash
sudo iptables -F
for entry in $(cat /usr/share/e-ag/webblocklist)
do
# echo "$entry"
sudo iptables -A OUTPUT -p tcp -m string --string "$entry" --algo kmp -j REJECT
done
s
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment