MINI
C:
/
siak
/
app
/
dukcapil
/
Upload File:
files >> C:/siak/app/dukcapil/DukcapilProxy.ps1
Add-Type -AssemblyName System.Windows.Forms Add-Type -AssemblyName System.Drawing # ============================== # KONFIGURASI # ============================== $AppPath = "C:\Siak_Terpusat_versi_12.4.1_WAR\index-x86.exe" $AppName = "index-x86" $ProxyIP = "192.168.25.15" $ProxyPort = 3030 # ============================== # FORM # ============================== $form = New-Object System.Windows.Forms.Form $form.Text = "DUKCAPIL PROXY v12.4.1" $form.Size = New-Object System.Drawing.Size(520,430) $form.StartPosition = "CenterScreen" $form.FormBorderStyle = "FixedSingle" $form.MaximizeBox = $false $form.BackColor = [System.Drawing.Color]::FromArgb(20,24,30) # ============================== # TITLE # ============================== $title = New-Object System.Windows.Forms.Label $title.Text = "DUKCAPIL PROXY" $title.ForeColor = [System.Drawing.Color]::White $title.Font = New-Object System.Drawing.Font( "Segoe UI",22, [System.Drawing.FontStyle]::Bold ) $title.AutoSize = $true $title.Location = New-Object System.Drawing.Point(145,25) $form.Controls.Add($title) $version = New-Object System.Windows.Forms.Label $version.Text = "SIAK TERPUSAT • v12.4.1" $version.ForeColor = [System.Drawing.Color]::Silver $version.Font = New-Object System.Drawing.Font("Segoe UI",10) $version.AutoSize = $true $version.Location = New-Object System.Drawing.Point(160,65) $form.Controls.Add($version) # ============================== # STATUS # ============================== $status = New-Object System.Windows.Forms.Label $status.Text = "● OFFLINE" $status.ForeColor = [System.Drawing.Color]::Red $status.Font = New-Object System.Drawing.Font( "Segoe UI",20, [System.Drawing.FontStyle]::Bold ) $status.AutoSize = $true $status.Location = New-Object System.Drawing.Point(190,105) $form.Controls.Add($status) # ============================== # INFO # ============================== $info = New-Object System.Windows.Forms.Label $info.ForeColor = [System.Drawing.Color]::White $info.Font = New-Object System.Drawing.Font("Consolas",11) $info.AutoSize = $true $info.Location = New-Object System.Drawing.Point(120,155) $info.Text = @" IP : $ProxyIP PORT : $ProxyPort PROGRAM : index-x86.exe PID : - "@ $form.Controls.Add($info) # ============================== # START BUTTON # ============================== $startButton = New-Object System.Windows.Forms.Button $startButton.Text = "START PROXY" $startButton.Size = New-Object System.Drawing.Size(150,45) $startButton.Location = New-Object System.Drawing.Point(90,250) $startButton.BackColor = [System.Drawing.Color]::FromArgb(30,160,80) $startButton.ForeColor = [System.Drawing.Color]::White $startButton.FlatStyle = "Flat" $startButton.Font = New-Object System.Drawing.Font( "Segoe UI",11, [System.Drawing.FontStyle]::Bold ) $form.Controls.Add($startButton) # ============================== # STOP BUTTON # ============================== $stopButton = New-Object System.Windows.Forms.Button $stopButton.Text = "STOP PROXY" $stopButton.Size = New-Object System.Drawing.Size(150,45) $stopButton.Location = New-Object System.Drawing.Point(275,250) $stopButton.BackColor = [System.Drawing.Color]::FromArgb(190,50,50) $stopButton.ForeColor = [System.Drawing.Color]::White $stopButton.FlatStyle = "Flat" $stopButton.Font = New-Object System.Drawing.Font( "Segoe UI",11, [System.Drawing.FontStyle]::Bold ) $form.Controls.Add($stopButton) # ============================== # RESTART BUTTON # ============================== $restartButton = New-Object System.Windows.Forms.Button $restartButton.Text = "RESTART" $restartButton.Size = New-Object System.Drawing.Size(150,40) $restartButton.Location = New-Object System.Drawing.Point(180,310) $restartButton.BackColor = [System.Drawing.Color]::FromArgb(45,100,180) $restartButton.ForeColor = [System.Drawing.Color]::White $restartButton.FlatStyle = "Flat" $restartButton.Font = New-Object System.Drawing.Font( "Segoe UI",10, [System.Drawing.FontStyle]::Bold ) $form.Controls.Add($restartButton) # ============================== # DETAIL # ============================== $detail = New-Object System.Windows.Forms.Label $detail.Text = "Proxy tidak berjalan" $detail.ForeColor = [System.Drawing.Color]::Silver $detail.Font = New-Object System.Drawing.Font("Segoe UI",9) $detail.AutoSize = $true $detail.Location = New-Object System.Drawing.Point(185,370) $form.Controls.Add($detail) # ============================== # UPDATE STATUS # ============================== function Update-ProxyStatus { $process = Get-Process -Name $AppName -ErrorAction SilentlyContinue if ($process) { $status.Text = "● ONLINE" $status.ForeColor = [System.Drawing.Color]::LimeGreen $info.Text = @" IP : $ProxyIP PORT : $ProxyPort PROGRAM : index-x86.exe PID : $($process.Id) "@ $detail.Text = "Proxy sedang berjalan" } else { $status.Text = "● OFFLINE" $status.ForeColor = [System.Drawing.Color]::Red $info.Text = @" IP : $ProxyIP PORT : $ProxyPort PROGRAM : index-x86.exe PID : - "@ $detail.Text = "Proxy tidak berjalan" } } # ============================== # START # ============================== $startButton.Add_Click({ $process = Get-Process -Name $AppName -ErrorAction SilentlyContinue if (!$process) { if (Test-Path $AppPath) { Start-Process ` -FilePath $AppPath ` -WorkingDirectory (Split-Path $AppPath) Start-Sleep -Seconds 2 } else { [System.Windows.Forms.MessageBox]::Show( "File tidak ditemukan:`n`n$AppPath", "ERROR" ) } } Update-ProxyStatus }) # ============================== # STOP # ============================== $stopButton.Add_Click({ $process = Get-Process -Name $AppName -ErrorAction SilentlyContinue if ($process) { $process | Stop-Process -Force Start-Sleep -Seconds 1 } Update-ProxyStatus }) # ============================== # RESTART # ============================== $restartButton.Add_Click({ $process = Get-Process -Name $AppName -ErrorAction SilentlyContinue if ($process) { $process | Stop-Process -Force Start-Sleep -Seconds 2 } if (Test-Path $AppPath) { Start-Process ` -FilePath $AppPath ` -WorkingDirectory (Split-Path $AppPath) Start-Sleep -Seconds 2 } Update-ProxyStatus }) # ============================== # AUTO CHECK # ============================== $timer = New-Object System.Windows.Forms.Timer $timer.Interval = 2000 $timer.Add_Tick({ Update-ProxyStatus }) $timer.Start() Update-ProxyStatus [void]$form.ShowDialog()
Copyright ©2021 || Defacer Indonesia