Logo Pastebin.fr
Pastebin

Retrouvez, créez et partagez vos snippets en temps réel.

WALID PASSINSURANCE 2026


Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing

# --- API WINDOWS ---
$signature = @'
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
'@
if (-not ([System.Management.Automation.PSTypeName]'Win32.WinApi').Type) {
    Add-Type -MemberDefinition $signature -Name "WinApi" -Namespace "Win32"
}

$secFile = "sec.sec"
$logFile = "access.log"

# --- LOGIQUE SÉCURITÉ ---
function Get-Hash ($string) {
    $sha = [System.Security.Cryptography.SHA256]::Create()
    $bytes = [System.Text.Encoding]::UTF8.GetBytes($string)
    $hash = $sha.ComputeHash($bytes)
    return [System.Convert]::ToBase64String($hash)
}

function Write-AccessLog ($msg) {
    $timestamp = Get-Date -Format "dd/MM/yyyy HH:mm:ss"
    "[$timestamp] $msg" | Out-File $logFile -Append -Encoding utf8
}

if (-not (Test-Path $secFile)) {
    $defaultPass = Get-Hash "123"
    $users = @("agent1", "agent2", "agent3", "agent4", "agent5", "agent6")
    $content = foreach ($u in $users) { "$u;$defaultPass;0" }
    $content | Out-File $secFile -Encoding utf8
}

function Update-UserPassword ($username, $newPass) {
    $lines = Get-Content $secFile
    $newContent = foreach ($line in $lines) {
        if ($line.Trim() -ne "") {
            $parts = $line.Split(';')
            if ($parts[0] -eq $username) { 
                "$username;$([string](Get-Hash $newPass));1" 
            } else { $line }
        }
    }
    $newContent | Out-File $secFile -Encoding utf8
    Write-AccessLog "Agent $username a modifié son mot de passe."
}

# --- INTERFACE STAR ASSURANCE ELITE ---
function Show-SecureLogin {
    $formLogin = New-Object System.Windows.Forms.Form
    $formLogin.Size = New-Object System.Drawing.Size(450, 420)
    $formLogin.StartPosition = "CenterScreen"
    $formLogin.FormBorderStyle = "None"
    $formLogin.BackColor = [System.Drawing.Color]::White

    # --- VARIABLES DE CONTRÔLE ---
    $script:attempts = 0

    # Déplacement natif
    $dragHandler = {
        if ($_.Button -eq [System.Windows.Forms.MouseButtons]::Left) {
            [void][Win32.WinApi]::ReleaseCapture()
            [void][Win32.WinApi]::SendMessage($formLogin.Handle, 0xA1, 0x2, 0)
        }
    }
    $formLogin.Add_MouseDown($dragHandler)

    $formLogin.Add_Paint({
        $g = $_.Graphics
        $rectHeader = New-Object System.Drawing.Rectangle(0, 0, 450, 85)
        # Dégradé Star 2026 (Vert profond Prestige)
        $brush = New-Object System.Drawing.Drawing2D.LinearGradientBrush($rectHeader, [System.Drawing.Color]::FromArgb(0, 70, 0), [System.Drawing.Color]::FromArgb(120, 190, 30), 0)
        $g.FillRectangle($brush, $rectHeader)
        $brush.Dispose()
        $pen = New-Object System.Drawing.Pen([System.Drawing.Color]::FromArgb(0, 80, 0), 2)
        $g.DrawRectangle($pen, 1, 1, 447, 417)
    })

    $titleLabel = New-Object System.Windows.Forms.Label
    $titleLabel.Text = "STAR ASSURANCE ELITE"; $titleLabel.Font = New-Object System.Drawing.Font("Segoe UI", 16, [System.Drawing.FontStyle]::Bold)
    $titleLabel.ForeColor = [System.Drawing.Color]::White; $titleLabel.BackColor = [System.Drawing.Color]::Transparent; $titleLabel.TextAlign = "MiddleCenter"; $titleLabel.Bounds = "0, 25, 450, 35"
    $titleLabel.Add_MouseDown($dragHandler)
    $formLogin.Controls.Add($titleLabel)

    # Inputs
    $uHUD = New-Object System.Windows.Forms.Label
    $uHUD.Text = "LOGIN AGENT"; $uHUD.ForeColor = [System.Drawing.Color]::DarkGreen; $uHUD.Font = New-Object System.Drawing.Font("Segoe UI", 8, [System.Drawing.FontStyle]::Bold); $uHUD.Location = "65, 110"; $uHUD.AutoSize = $true
    $formLogin.Controls.Add($uHUD)

    $textBoxUser = New-Object System.Windows.Forms.TextBox; $textBoxUser.Bounds = "65, 130, 320, 35"; $textBoxUser.Font = "Segoe UI, 12"; $textBoxUser.BorderStyle = "FixedSingle"
    $formLogin.Controls.Add($textBoxUser)

    $pHUD = New-Object System.Windows.Forms.Label
    $pHUD.Text = "CLEF D'ACCÈS"; $pHUD.ForeColor = [System.Drawing.Color]::DarkGreen; $pHUD.Font = New-Object System.Drawing.Font("Segoe UI", 8, [System.Drawing.FontStyle]::Bold); $pHUD.Location = "65, 180"; $pHUD.AutoSize = $true
    $formLogin.Controls.Add($pHUD)

    $textBoxPass = New-Object System.Windows.Forms.TextBox; $textBoxPass.Bounds = "65, 200, 270, 35"; $textBoxPass.Font = "Segoe UI, 12"; $textBoxPass.UseSystemPasswordChar = $true; $textBoxPass.BorderStyle = "FixedSingle"
    $formLogin.Controls.Add($textBoxPass)

    # Oeil Interactif
    $eye = New-Object System.Windows.Forms.Button
    $eye.Text = "👁️"; $eye.Font = New-Object System.Drawing.Font("Segoe UI Emoji", 14); $eye.Bounds = "335, 200, 50, 35"; $eye.FlatStyle = "Flat"; $eye.FlatAppearance.BorderSize = 0; $eye.BackColor = "White"
    $eye.Add_Click({
        $textBoxPass.UseSystemPasswordChar = -not $textBoxPass.UseSystemPasswordChar
        $eye.ForeColor = if($textBoxPass.UseSystemPasswordChar){[System.Drawing.Color]::Black}else{[System.Drawing.Color]::LimeGreen}
    })
    $formLogin.Controls.Add($eye)

    # Bouton avec effet de survol (Hover)
    $okButton = New-Object System.Windows.Forms.Button
    $okButton.Text = "VÉRIFIER L'ACCÈS"; $okButton.Font = New-Object System.Drawing.Font("Segoe UI", 10, [System.Drawing.FontStyle]::Bold); $okButton.BackColor = [System.Drawing.Color]::DarkGreen; $okButton.ForeColor = "White"; $okButton.FlatStyle = "Flat"; $okButton.Bounds = "65, 260, 320, 45"
    $okButton.Add_MouseEnter({ $okButton.BackColor = [System.Drawing.Color]::LimeGreen })
    $okButton.Add_MouseLeave({ $okButton.BackColor = [System.Drawing.Color]::DarkGreen })
    $formLogin.Controls.Add($okButton)

    $statusLabel = New-Object System.Windows.Forms.Label
    $statusLabel.Bounds = "0, 320, 450, 30"; $statusLabel.TextAlign = "MiddleCenter"; $statusLabel.Font = New-Object System.Drawing.Font("Segoe UI", 9, [System.Drawing.FontStyle]::Bold)
    $formLogin.Controls.Add($statusLabel)

    # Panel Reset
    $panelReset = New-Object System.Windows.Forms.Panel; $panelReset.Bounds = "0, 420, 450, 150"; $panelReset.BackColor = [System.Drawing.Color]::FromArgb(245, 255, 245); $panelReset.Visible = $false
    $formLogin.Controls.Add($panelReset)

    $txtNewPass = New-Object System.Windows.Forms.TextBox; $txtNewPass.Bounds = "65, 25, 320, 30"; $txtNewPass.UseSystemPasswordChar = $true; $txtNewPass.BorderStyle = "FixedSingle"
    $panelReset.Controls.Add($txtNewPass)

    $btnConfirm = New-Object System.Windows.Forms.Button; $btnConfirm.Text = "ENREGISTRER NOUVEAUX PARAMÈTRES"; $btnConfirm.BackColor = [System.Drawing.Color]::DarkGreen; $btnConfirm.ForeColor = "White"; $btnConfirm.FlatStyle = "Flat"; $btnConfirm.Bounds = "65, 70, 320, 35"
    $panelReset.Controls.Add($btnConfirm)

    $lnk = New-Object System.Windows.Forms.LinkLabel; $lnk.Text = "Paramètres de sécurité"; $lnk.LinkColor = "DarkGreen"; $lnk.Bounds = "0, 360, 450, 20"; $lnk.TextAlign = "MiddleCenter"
    $formLogin.Controls.Add($lnk)

    $lnk.Add_Click({
        if ($formLogin.Height -le 420) { $formLogin.Height = 580; $panelReset.Visible = $true } else { $formLogin.Height = 420; $panelReset.Visible = $false }
    })

    $btnConfirm.Add_Click({
        if ($textBoxUser.Text -ne "" -and $txtNewPass.Text.Length -ge 3) {
            Update-UserPassword $textBoxUser.Text $txtNewPass.Text
            $statusLabel.Text = "VOTRE SÉCURITÉ A ÉTÉ MISE À JOUR"; $statusLabel.ForeColor = "DarkGreen"; $formLogin.Height = 420
        }
    })

    # Bouton Fermer
    $closeBtn = New-Object System.Windows.Forms.Button
    $closeBtn.Text = "✕"; $closeBtn.Font = New-Object System.Drawing.Font("Segoe UI", 12, [System.Drawing.FontStyle]::Bold); $closeBtn.ForeColor = "White"; $closeBtn.BackColor = "Transparent"; $closeBtn.Bounds = "415, 5, 30, 30"; $closeBtn.FlatStyle = "Flat"; $closeBtn.FlatAppearance.BorderSize = 0
    $closeBtn.Add_Click({ $formLogin.Close() })
    $formLogin.Controls.Add($closeBtn)

    # LOGIQUE DE CONNEXION AVEC SÉCURITÉ ACCRUE
    $okButton.Add_Click({
        if ($script:attempts -ge 3) { $statusLabel.Text = "SYSTÈME VERROUILLÉ (TROP D'ESSAIS)"; return }
        
        $uIn = $textBoxUser.Text; $pIn = Get-Hash $textBoxPass.Text
        $db = Get-Content $secFile
        $found = $false

        foreach($line in $db) {
            $p = $line.Split(';')
            if ($uIn -eq $p[0] -and $pIn -eq $p[1]) {
                $found = $true
                if ($p[2] -eq "0") { $lnk.PerformClick(); $statusLabel.Text = "PREMIÈRE UTILISATION : CHANGEZ LE CODE"; $statusLabel.ForeColor = "OrangeRed"; return }
                break
            }
        }

        if ($found) {
            Write-AccessLog "Connexion réussie : $uIn"
            $formLogin.Tag = $uIn; $formLogin.DialogResult = "OK"; $formLogin.Close()
        } else {
            $script:attempts++
            $statusLabel.Text = "ALERTE : IDENTIFIANT INCORRECT ($script:attempts/3)"; $statusLabel.ForeColor = "Red"
            Write-AccessLog "Échec de connexion pour : $uIn"
        }
    })

    if ($formLogin.ShowDialog() -eq "OK") { return $formLogin.Tag }
    return $null
}

# --- EXECUTION ---
$User = Show-SecureLogin
if ($User) {
    # On peut même ajouter un petit message de bienvenue pro
    Write-Host "Accès Terminal Star Assurance accordé à $User" -ForegroundColor Green
    $scriptPath = 'C:\Users\walid\Desktop\123\initial 20-01-2026with func.ps1'
    if (Test-Path $scriptPath) { . $scriptPath }
}

Créé il y a 2 semaines.

Rechercher un Pastebin

Aucun paste trouvé.