Skip to content

Commit

Permalink
v0.3 + Re-creating SSH keys (ssh-keyscan)
Browse files Browse the repository at this point in the history
  • Loading branch information
AKotov-dev committed Sep 10, 2024
1 parent 398de6d commit 1597f9e
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 68 deletions.
11 changes: 9 additions & 2 deletions sshuttle-gui/backup/sshuttle_gui.lps
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<CursorPos X="13"/>
<UsageCount Value="40"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit>
<Unit>
<Filename Value="pingtrd.pas"/>
Expand All @@ -71,7 +70,7 @@
<UsageCount Value="35"/>
</Unit>
</Units>
<JumpHistory HistoryIndex="5">
<JumpHistory HistoryIndex="7">
<Position>
<Filename Value="unit1.pas"/>
<Caret Column="13"/>
Expand All @@ -96,6 +95,14 @@
<Filename Value="unit1.pas"/>
<Caret Column="13"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="3" Column="52"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="141" Column="62" TopLine="113"/>
</Position>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
Expand Down
30 changes: 14 additions & 16 deletions sshuttle-gui/backup/unit1.lfm
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
object MainForm: TMainForm
Left = 287
Height = 192
Height = 189
Top = 125
Width = 531
Caption = 'SShuttle-GUI'
ClientHeight = 192
ClientHeight = 189
ClientWidth = 531
OnCreate = FormCreate
OnShow = FormShow
Expand Down Expand Up @@ -62,7 +62,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrCenter
Left = 8
Height = 17
Top = 58
Top = 59
Width = 40
Caption = 'Server:'
ParentColor = False
Expand All @@ -74,10 +74,10 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 51
Height = 37
Top = 48
Top = 49
Width = 221
BorderSpacing.Left = 3
BorderSpacing.Top = 5
BorderSpacing.Top = 6
BorderSpacing.Right = 10
TabOrder = 2
end
Expand All @@ -87,7 +87,7 @@ object MainForm: TMainForm
AnchorSideRight.Side = asrBottom
Left = 283
Height = 32
Top = 135
Top = 136
Width = 242
Anchors = [akTop, akRight]
BorderSpacing.Right = 6
Expand All @@ -102,7 +102,7 @@ object MainForm: TMainForm
AnchorSideRight.Side = asrBottom
Left = 343
Height = 32
Top = 100
Top = 101
Width = 182
Anchors = [akTop, akRight]
BorderSpacing.Right = 6
Expand All @@ -119,7 +119,7 @@ object MainForm: TMainForm
AnchorSideBottom.Control = PortEdit
AnchorSideBottom.Side = asrBottom
Left = 433
Height = 79
Height = 80
Top = 6
Width = 92
Anchors = [akTop, akLeft, akRight, akBottom]
Expand All @@ -134,7 +134,7 @@ object MainForm: TMainForm
object StaticText1: TStaticText
Left = 0
Height = 20
Top = 172
Top = 169
Width = 531
Align = alBottom
BorderStyle = sbsSingle
Expand All @@ -153,7 +153,7 @@ object MainForm: TMainForm
AnchorSideRight.Control = StartBtn
Left = 416
Height = 12
Top = 39
Top = 40
Width = 12
BorderSpacing.Left = 9
BorderSpacing.Right = 5
Expand All @@ -168,7 +168,7 @@ object MainForm: TMainForm
AnchorSideRight.Control = PortEdit
Left = 282
Height = 17
Top = 58
Top = 59
Width = 29
BorderSpacing.Right = 3
Caption = 'Port:'
Expand All @@ -182,7 +182,7 @@ object MainForm: TMainForm
AnchorSideRight.Side = asrBottom
Left = 314
Height = 37
Top = 48
Top = 49
Width = 93
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 3
Expand All @@ -194,7 +194,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 8
Height = 32
Top = 100
Top = 101
Width = 120
BorderSpacing.Top = 15
Caption = '--disable-ipv6'
Expand All @@ -205,12 +205,10 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 8
Height = 32
Top = 135
Top = 136
Width = 161
BorderSpacing.Top = 3
Caption = '--no-latency-control'
Checked = True
State = cbChecked
TabOrder = 6
end
object IniPropStorage1: TIniPropStorage
Expand Down
17 changes: 11 additions & 6 deletions sshuttle-gui/backup/unit1.pas
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ procedure TMainForm.FormCreate(Sender: TObject);
FCheckPingThread.Priority := tpNormal;
end;

//Флаг очистки кеша браузеров при старте GUI
procedure TMainForm.ClearBoxChange(Sender: TObject);
var
S: ansistring;
Expand All @@ -127,6 +128,7 @@ procedure TMainForm.ClearBoxChange(Sender: TObject);
RunCommand('/bin/bash', ['-c', 'touch /etc/sshuttle-gui/clear'], S);
end;

//Автостарт SShuttle после загрузки
procedure TMainForm.AutoStartBoxChange(Sender: TObject);
var
S: ansistring;
Expand All @@ -135,9 +137,9 @@ procedure TMainForm.AutoStartBoxChange(Sender: TObject);
Application.ProcessMessages;

if not AutoStartBox.Checked then
RunCommand('/bin/bash', ['-c', 'systemctl disable sshuttle.service'], S)
RunCommand('/bin/bash', ['-c', 'systemctl disable sshuttle'], S)
else
RunCommand('/bin/bash', ['-c', 'systemctl enable sshuttle.service'], S);
RunCommand('/bin/bash', ['-c', 'systemctl enable sshuttle'], S);
Screen.Cursor := crDefault;
end;

Expand Down Expand Up @@ -167,10 +169,10 @@ procedure TMainForm.StartBtnClick(Sender: TObject);
if (UserEdit.Text = '') or (PasswordEdit.Text = '') or
(ServerEdit.Text = '') or (PortEdit.Text = '') then Exit;

//Сохранение параметров
//Сохраняем параметры
IniPropStorage1.Save;

//Дополнительные параметры
//Построение дополнительных параметров
Pars := '';
if IPv6Box.Checked then Pars := IPv6Box.Caption;
if LatencyBox.Checked then Pars := Concat(Pars, ' ', LatencyBox.Caption);
Expand All @@ -180,7 +182,7 @@ procedure TMainForm.StartBtnClick(Sender: TObject);
if StartBtn.Caption = SStop then
begin
Shape1.Brush.Color := clYellow;
StartProcess('systemctl stop sshuttle.service; pidof sshpass && killall sshpass; iptables -t nat -F');
StartProcess('systemctl stop sshuttle; pidof sshpass && killall sshpass; iptables -t nat -F');
end
else
try
Expand All @@ -202,6 +204,8 @@ procedure TMainForm.StartBtnClick(Sender: TObject);
Trim(UserEdit.Text) + '@' + Trim(ServerEDit.Text) + ' -p ' +
Trim(PortEdit.Text) + ' exit 0'); }

//Забираем публичные ключи с сервера
S.Add('# Забираем публичные ключи с сервера');
S.Add('pidof sshpass && killall sshpass; iptables -t nat -F');
S.Add('ssh-keyscan -p ' + PortEdit.Text + ' ' + ServerEDit.Text +
' >> /root/.ssh/known_hosts');
Expand All @@ -216,14 +220,15 @@ procedure TMainForm.StartBtnClick(Sender: TObject);

S.Add('');

S.Add('# Принудительная очистка iptables nat');
S.Add('iptables -t nat -F');

S.Add('exit 0;');

S.SaveToFile('/etc/sshuttle-gui/connect.sh');

//Запускаем скрипт через systemd
StartProcess('chmod +x /etc/sshuttle-gui/connect.sh; systemctl restart sshuttle.service');
StartProcess('chmod +x /etc/sshuttle-gui/connect.sh; systemctl restart sshuttle');

finally
S.Free;
Expand Down
Binary file modified sshuttle-gui/lib/x86_64-linux/pingtrd.ppu
Binary file not shown.
Binary file modified sshuttle-gui/lib/x86_64-linux/sshuttle_gui.or
Binary file not shown.
36 changes: 18 additions & 18 deletions sshuttle-gui/lib/x86_64-linux/unit1.lfm
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
object MainForm: TMainForm
Left = 287
Height = 192
Height = 189
Top = 125
Width = 531
Caption = 'SShuttle-GUI'
ClientHeight = 192
ClientHeight = 189
ClientWidth = 531
OnCreate = FormCreate
OnShow = FormShow
Expand Down Expand Up @@ -62,7 +62,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrCenter
Left = 8
Height = 17
Top = 58
Top = 59
Width = 40
Caption = 'Server:'
ParentColor = False
Expand All @@ -74,10 +74,10 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 51
Height = 37
Top = 48
Width = 221
Top = 49
Width = 213
BorderSpacing.Left = 3
BorderSpacing.Top = 5
BorderSpacing.Top = 6
BorderSpacing.Right = 10
TabOrder = 2
end
Expand All @@ -87,7 +87,7 @@ object MainForm: TMainForm
AnchorSideRight.Side = asrBottom
Left = 283
Height = 32
Top = 135
Top = 136
Width = 242
Anchors = [akTop, akRight]
BorderSpacing.Right = 6
Expand All @@ -102,7 +102,7 @@ object MainForm: TMainForm
AnchorSideRight.Side = asrBottom
Left = 343
Height = 32
Top = 100
Top = 101
Width = 182
Anchors = [akTop, akRight]
BorderSpacing.Right = 6
Expand All @@ -119,7 +119,7 @@ object MainForm: TMainForm
AnchorSideBottom.Control = PortEdit
AnchorSideBottom.Side = asrBottom
Left = 433
Height = 79
Height = 80
Top = 6
Width = 92
Anchors = [akTop, akLeft, akRight, akBottom]
Expand All @@ -134,7 +134,7 @@ object MainForm: TMainForm
object StaticText1: TStaticText
Left = 0
Height = 20
Top = 172
Top = 169
Width = 531
Align = alBottom
BorderStyle = sbsSingle
Expand All @@ -153,7 +153,7 @@ object MainForm: TMainForm
AnchorSideRight.Control = StartBtn
Left = 416
Height = 12
Top = 39
Top = 40
Width = 12
BorderSpacing.Left = 9
BorderSpacing.Right = 5
Expand All @@ -166,9 +166,9 @@ object MainForm: TMainForm
AnchorSideTop.Control = ServerEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = PortEdit
Left = 282
Left = 274
Height = 17
Top = 58
Top = 59
Width = 29
BorderSpacing.Right = 3
Caption = 'Port:'
Expand All @@ -180,10 +180,10 @@ object MainForm: TMainForm
AnchorSideTop.Control = ServerEdit
AnchorSideRight.Control = PasswordEdit
AnchorSideRight.Side = asrBottom
Left = 314
Left = 306
Height = 37
Top = 48
Width = 93
Top = 49
Width = 101
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 3
TabOrder = 3
Expand All @@ -194,7 +194,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 8
Height = 32
Top = 100
Top = 101
Width = 120
BorderSpacing.Top = 15
Caption = '--disable-ipv6'
Expand All @@ -205,7 +205,7 @@ object MainForm: TMainForm
AnchorSideTop.Side = asrBottom
Left = 8
Height = 32
Top = 135
Top = 136
Width = 161
BorderSpacing.Top = 3
Caption = '--no-latency-control'
Expand Down
Binary file modified sshuttle-gui/lib/x86_64-linux/unit1.o
Binary file not shown.
Binary file modified sshuttle-gui/lib/x86_64-linux/unit1.ppu
Binary file not shown.
2 changes: 1 addition & 1 deletion sshuttle-gui/pingtrd.pas
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ procedure CheckPing.Execute;
end;
end;

//Индикация: Cветодиод, Режим
//Индикация: светодиод, режим
procedure CheckPing.ShowStatus;
begin
with MainForm do
Expand Down
Binary file modified sshuttle-gui/sshuttle_gui
Binary file not shown.
10 changes: 9 additions & 1 deletion sshuttle-gui/sshuttle_gui.lps
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<UsageCount Value="35"/>
</Unit>
</Units>
<JumpHistory HistoryIndex="5">
<JumpHistory HistoryIndex="7">
<Position>
<Filename Value="unit1.pas"/>
<Caret Column="13"/>
Expand All @@ -96,6 +96,14 @@
<Filename Value="unit1.pas"/>
<Caret Column="13"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="3" Column="52"/>
</Position>
<Position>
<Filename Value="unit1.pas"/>
<Caret Line="141" Column="62" TopLine="113"/>
</Position>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
Expand Down
Loading

0 comments on commit 1597f9e

Please sign in to comment.