Skip to content
This repository has been archived by the owner on Feb 5, 2020. It is now read-only.

Commit

Permalink
add check kill-switch
Browse files Browse the repository at this point in the history
  • Loading branch information
akbaryahya committed May 17, 2017
1 parent 82ee4c9 commit f34ad53
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
17 changes: 15 additions & 2 deletions WannaCrypt Detection/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 45 additions & 2 deletions WannaCrypt Detection/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Management.Automation;
using System.Net.Sockets;
using System.Security.Principal;
using System.Text;
using System.Threading;
using WUApiLib;
// ReSharper disable LocalizableElement
Expand Down Expand Up @@ -46,6 +47,15 @@ static string IsWindows()
if (reg != null) return (string)reg.GetValue("ProductName");
return "Not known";
}
private static string InternalReadAllText(string path, Encoding encoding)
{
string result;
using (StreamReader streamReader = new StreamReader(path, encoding))
{
result = streamReader.ReadToEnd();
}
return result;
}
public bool IsProcessOpen(string name)
{
foreach (Process clsProcess in Process.GetProcesses())
Expand Down Expand Up @@ -274,7 +284,7 @@ public void Logme(Color color, string text)
}
catch (Exception)
{
//look bug
//noting here
}
}
else
Expand Down Expand Up @@ -355,14 +365,47 @@ private void BlokPort_z_Click(object sender, EventArgs e)
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
Logme(Color.Red, ex.ToString());
}
}

private void smboff_Click(object sender, EventArgs e)
{
Startpatchmbs();
}

private void upkill_Click(object sender, EventArgs e)
{
var host = @"C:\Windows\System32\drivers\etc\hosts";
try
{
if (File.Exists(host))
{
string readText = InternalReadAllText(host,Encoding.UTF8);
if (readText != null)
{
if (!readText.Contains("216.58.197.132"))
{
File.AppendAllText(host, "216.58.197.132 www.iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea.com" + Environment.NewLine);
File.AppendAllText(host, "216.58.197.132 iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea.com" + Environment.NewLine);
File.AppendAllText(host, "216.58.197.132 www.ifferfsodp9ifjaposdfjhgosurijfaewrwergwea.com" + Environment.NewLine);
File.AppendAllText(host, "216.58.197.132 ifferfsodp9ifjaposdfjhgosurijfaewrwergwea.com" + Environment.NewLine);
File.AppendAllText(host, "216.58.197.132 www.iuqssfsodp9ifjaposdfjhgosurijfaewrwergwea.com" + Environment.NewLine);
File.AppendAllText(host, "216.58.197.132 iuqssfsodp9ifjaposdfjhgosurijfaewrwergwea.com" + Environment.NewLine);
File.AppendAllText(host, "216.58.197.132 www.ayylmaotjhsstasdfasdfasdfasdfasdfasdfasdf.com" + Environment.NewLine);
File.AppendAllText(host, "216.58.197.132 ayylmaotjhsstasdfasdfasdfasdfasdfasdfasdf.com" + Environment.NewLine);
Logme(Color.Green, "OK");
return;
}
}
}
Logme(Color.Gold, "No host found or Has been in patch");
}
catch (Exception ex)
{
Logme(Color.Red, ex.ToString());
}
}
}
public static class ThreadHelperClass
{
Expand Down

0 comments on commit f34ad53

Please sign in to comment.