mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-19 09:56:10 +00:00
f2ac1ece55
add
288 lines
18 KiB
C#
288 lines
18 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: Boggle.modFindWords
|
|
// Assembly: Boggle, Version=1.0.1320.31511, Culture=neutral, PublicKeyToken=null
|
|
// MVID: B8BB850A-887A-43B2-B89D-3D1301289D01
|
|
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare.00004-msil\Virus.Win32.Lykov.b-5b4c66fd4c89a7645d7912c18b43ddd7b8db068aa896fea714881ce355eaf833.exe
|
|
|
|
using Microsoft.VisualBasic;
|
|
using Microsoft.VisualBasic.CompilerServices;
|
|
using System;
|
|
using System.Data;
|
|
using System.Data.OleDb;
|
|
using System.IO;
|
|
using System.Net;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Text;
|
|
|
|
namespace Boggle
|
|
{
|
|
[StandardModule]
|
|
internal sealed class modFindWords
|
|
{
|
|
public static DataTable FindWords(modFindWords.FindMode Mode, string Word = "")
|
|
{
|
|
object[] objArray = new object[2];
|
|
DataTable words = new DataTable();
|
|
string str1 = "((((";
|
|
string sLeft1;
|
|
string sLeft2;
|
|
string sLeft3;
|
|
string str2;
|
|
string sLeft4;
|
|
string str3;
|
|
string str4;
|
|
if (Mode == modFindWords.FindMode.SpecWord)
|
|
{
|
|
if (Strings.Len(Word) > 15)
|
|
{
|
|
objArray[0] = (object) "Not Found";
|
|
objArray[1] = (object) "1111";
|
|
words.Rows.Add(objArray);
|
|
return words;
|
|
}
|
|
Word = Strings.UCase(Word);
|
|
int num = Strings.Len(Strings.Replace(Word, "QU", "Q"));
|
|
int Start = 1;
|
|
while (Start <= num)
|
|
{
|
|
string sLeft5 = Strings.Mid(Word, Start, 1);
|
|
if (StringType.StrCmp(sLeft1, "", false) == 0)
|
|
{
|
|
if (StringType.StrCmp(sLeft5, "Q", false) == 0)
|
|
{
|
|
Word = Strings.Replace(Word, "QU", "Q");
|
|
sLeft1 = sLeft1 + "Where PossibleLetters_" + StringType.FromInteger(Start) + ".BaseLetter = 'QU' \r\n";
|
|
}
|
|
else
|
|
sLeft1 = sLeft1 + ("Where PossibleLetters_" + StringType.FromInteger(Start) + ".BaseLetter = '" + sLeft5) + "' \r\n";
|
|
}
|
|
else if (StringType.StrCmp(sLeft5, "Q", false) == 0)
|
|
{
|
|
Word = Strings.Replace(Word, "QU", "Q");
|
|
sLeft1 = sLeft1 + "And PossibleLetters_" + StringType.FromInteger(Start) + ".BaseLetter = 'QU' \r\n";
|
|
}
|
|
else
|
|
sLeft1 = sLeft1 + ("And PossibleLetters_" + StringType.FromInteger(Start) + ".BaseLetter = '" + sLeft5) + "' \r\n";
|
|
if (Start > 5)
|
|
{
|
|
str1 += "(";
|
|
if (StringType.StrCmp(sLeft2, "", false) == 0)
|
|
sLeft2 += ") ";
|
|
if (StringType.StrCmp(sLeft3, "", false) == 0)
|
|
sLeft3 += "+ ";
|
|
if (StringType.StrCmp(str2, "", false) == 0)
|
|
str2 += ",";
|
|
if (StringType.StrCmp(sLeft4, "", false) == 0)
|
|
{
|
|
if (Strings.Len(Word) == Start)
|
|
{
|
|
str3 = str3 + " & ',' & [BL" + StringType.FromInteger(Start) + "] ";
|
|
str4 = str4 + ", PossibleLetters_" + StringType.FromInteger(Start) + ".BaseLetterSquare ";
|
|
sLeft4 = sLeft4 + ", PossibleLetters_" + StringType.FromInteger(Start) + ".BaseLetterSquare AS BL" + StringType.FromInteger(Start) + " ";
|
|
}
|
|
else
|
|
{
|
|
str3 = str3 + " & ',' & [BL" + StringType.FromInteger(Start) + "] " + "&" + " ";
|
|
str4 = str4 + ", PossibleLetters_" + StringType.FromInteger(Start) + ".BaseLetterSquare , ";
|
|
sLeft4 = sLeft4 + ", PossibleLetters_" + StringType.FromInteger(Start) + ".BaseLetterSquare AS BL" + StringType.FromInteger(Start) + ", ";
|
|
}
|
|
}
|
|
else if (Start == Strings.Len(Word))
|
|
{
|
|
str3 = str3 + "',' & [BL" + StringType.FromInteger(Start) + "]";
|
|
str4 = str4 + " PossibleLetters_" + StringType.FromInteger(Start) + ".BaseLetterSquare ";
|
|
sLeft4 = sLeft4 + " PossibleLetters_" + StringType.FromInteger(Start) + ".BaseLetterSquare AS BL" + StringType.FromInteger(Start) + " ";
|
|
}
|
|
else
|
|
{
|
|
str3 = str3 + "',' & [BL" + StringType.FromInteger(Start) + "] " + "&" + " ";
|
|
str4 = str4 + " PossibleLetters_" + StringType.FromInteger(Start) + ".BaseLetterSquare , ";
|
|
sLeft4 = sLeft4 + " PossibleLetters_" + StringType.FromInteger(Start) + ".BaseLetterSquare AS BL" + StringType.FromInteger(Start) + ", ";
|
|
}
|
|
if (Start == Strings.Len(Word))
|
|
{
|
|
str2 = str2 + "BL" + StringType.FromInteger(Start);
|
|
sLeft3 = sLeft3 + "PossibleLetters_" + StringType.FromInteger(Start) + ".BaseLetter";
|
|
sLeft2 = sLeft2 + ("INNER JOIN PossibleLetters AS PossibleLetters_" + StringType.FromInteger(Start) + " ON (PossibleLetters_" + StringType.FromInteger(checked (Start - 1)) + ".FriendLetter=PossibleLetters_" + StringType.FromInteger(Start) + ".BaseLetter) AND (PossibleLetters_" + StringType.FromInteger(checked (Start - 1)) + ".FriendLetterSquare=PossibleLetters_" + StringType.FromInteger(Start)) + ".BaseLetterSquare) \r\n";
|
|
}
|
|
else
|
|
{
|
|
str2 = str2 + "BL" + StringType.FromInteger(Start) + ",";
|
|
sLeft3 = sLeft3 + "PossibleLetters_" + StringType.FromInteger(Start) + ".BaseLetter + ";
|
|
sLeft2 = sLeft2 + ("INNER JOIN PossibleLetters AS PossibleLetters_" + StringType.FromInteger(Start) + " ON (PossibleLetters_" + StringType.FromInteger(checked (Start - 1)) + ".FriendLetter=PossibleLetters_" + StringType.FromInteger(Start) + ".BaseLetter) AND (PossibleLetters_" + StringType.FromInteger(checked (Start - 1)) + ".FriendLetterSquare=PossibleLetters_" + StringType.FromInteger(Start)) + ".BaseLetterSquare)) \r\n";
|
|
}
|
|
}
|
|
checked { ++Start; }
|
|
}
|
|
}
|
|
words.Columns.Add("FoundWord");
|
|
words.Columns.Add("FoundWordSquares");
|
|
modGlobal.cmdBog.CommandText = "Delete From Words_5Letters1";
|
|
modGlobal.conBoggle.Open();
|
|
modGlobal.cmdBog.ExecuteNonQuery();
|
|
modGlobal.conBoggle.Close();
|
|
modGlobal.cmdBog.CommandText = "Delete From Words_5Letters2";
|
|
modGlobal.conBoggle.Open();
|
|
modGlobal.cmdBog.ExecuteNonQuery();
|
|
modGlobal.conBoggle.Close();
|
|
modGlobal.cmdBog.CommandText = "Delete From Words_4Letters";
|
|
modGlobal.conBoggle.Open();
|
|
modGlobal.cmdBog.ExecuteNonQuery();
|
|
modGlobal.conBoggle.Close();
|
|
modGlobal.cmdBog.CommandText = "Delete From Words_3Letters";
|
|
modGlobal.conBoggle.Open();
|
|
modGlobal.cmdBog.ExecuteNonQuery();
|
|
modGlobal.conBoggle.Close();
|
|
modGlobal.cmdBog.CommandText = "Delete From FoundWords";
|
|
modGlobal.conBoggle.Open();
|
|
modGlobal.cmdBog.ExecuteNonQuery();
|
|
modGlobal.conBoggle.Close();
|
|
modGlobal.cmdBog.CommandText = "Insert Into Words_5Letters1 (Word,Bl1,Bl2,Bl3,Bl4,Bl5" + str2 + ") SELECT PossibleLetters_1.BaseLetter + PossibleLetters_2.BaseLetter + PossibleLetters_3.BaseLetter + PossibleLetters_4.BaseLetter + PossibleLetters_5.BaseLetter " + sLeft3 + " AS Word, PossibleLetters_1.BaseLetterSquare AS BL1, PossibleLetters_2.BaseLetterSquare AS BL2, PossibleLetters_3.BaseLetterSquare AS BL3, PossibleLetters_4.BaseLetterSquare AS BL4, PossibleLetters_5.BaseLetterSquare AS BL5 " + sLeft4 + "FROM " + str1 + "PossibleLetters INNER JOIN PossibleLetters AS PossibleLetters_1 ON (PossibleLetters.FriendLetter=PossibleLetters_1.BaseLetter) AND (PossibleLetters.FriendLetterSquare=PossibleLetters_1.BaseLetterSquare)) INNER JOIN PossibleLetters AS PossibleLetters_2 ON (PossibleLetters_1.FriendLetter=PossibleLetters_2.BaseLetter) AND (PossibleLetters_1.FriendLetterSquare=PossibleLetters_2.BaseLetterSquare)) INNER JOIN PossibleLetters AS PossibleLetters_3 ON (PossibleLetters_2.FriendLetter=PossibleLetters_3.BaseLetter) AND (PossibleLetters_2.FriendLetterSquare=PossibleLetters_3.BaseLetterSquare)) INNER JOIN PossibleLetters AS PossibleLetters_4 ON (PossibleLetters_3.FriendLetter=PossibleLetters_4.BaseLetter) AND (PossibleLetters_3.FriendLetterSquare=PossibleLetters_4.BaseLetterSquare)) INNER JOIN PossibleLetters AS PossibleLetters_5 ON (PossibleLetters_4.FriendLetter=PossibleLetters_5.BaseLetter) AND (PossibleLetters_4.FriendLetterSquare=PossibleLetters_5.BaseLetterSquare) " + sLeft2 + sLeft1 + "GROUP BY PossibleLetters_1.BaseLetter + PossibleLetters_2.BaseLetter + PossibleLetters_3.BaseLetter + PossibleLetters_4.BaseLetter + PossibleLetters_5.BaseLetter " + sLeft3 + ", PossibleLetters_1.BaseLetterSquare, PossibleLetters_2.BaseLetterSquare, PossibleLetters_3.BaseLetterSquare, PossibleLetters_4.BaseLetterSquare, PossibleLetters_5.BaseLetterSquare" + str4;
|
|
modGlobal.conBoggle.Open();
|
|
modGlobal.cmdBog.ExecuteNonQuery();
|
|
modGlobal.conBoggle.Close();
|
|
modGlobal.cmdBog.CommandText = "Insert Into Words_5Letters2 (Word,WordSquares) SELECT Words_5Letters1.[Word], [BL1] & ',' & [BL2] & ',' & [BL3] & ',' & [BL4] & ',' & [BL5]" + str3 + " AS WordSquares FROM (Words_5Letters1) WHERE (((Words_5Letters1.BL1) Not In ([bl2],[bl3],[bl4],[bl5]" + str2 + ")) AND ((Words_5Letters1.BL2) Not In ([bl1],[bl3],[bl4],[bl5]" + str2 + ")) AND ((Words_5Letters1.BL3) Not In ([bl1],[bl2],[bl4],[bl5]" + str2 + ")) AND ((Words_5Letters1.BL4) Not In ([bl1],[bl2],[bl3],[bl5]" + str2 + ")) AND ((Words_5Letters1.BL5) Not In ([bl1],[bl2],[bl3],[bl4]" + str2 + ")) AND ((Words_5Letters1.BL6) Not In ([bl1],[bl2],[bl3],[bl4],[bl5]" + Strings.Replace(str2, ",BL6", "") + ")Or BL6 Is Null) AND ((Words_5Letters1.BL7) Not In ([bl1],[bl2],[bl3],[bl4],[bl5]" + Strings.Replace(str2, ",BL7", "") + ")Or BL7 Is Null) AND ((Words_5Letters1.BL8) Not In ([bl1],[bl2],[bl3],[bl4],[bl5]" + Strings.Replace(str2, ",BL8", "") + ")Or BL8 Is Null) AND ((Words_5Letters1.BL9) Not In ([bl1],[bl2],[bl3],[bl4],[bl5]" + Strings.Replace(str2, ",BL9", "") + ")Or BL9 Is Null) AND ((Words_5Letters1.BL10) Not In ([bl1],[bl2],[bl3],[bl4],[bl5]" + Strings.Replace(str2, ",BL10", "") + ")Or BL10 Is Null) AND ((Words_5Letters1.BL11) Not In ([bl1],[bl2],[bl3],[bl4],[bl5]" + Strings.Replace(str2, ",BL11", "") + ")Or BL11 Is Null) AND ((Words_5Letters1.BL12) Not In ([bl1],[bl2],[bl3],[bl4],[bl5]" + Strings.Replace(str2, ",BL12", "") + ")Or BL12 Is Null) AND ((Words_5Letters1.BL13) Not In ([bl1],[bl2],[bl3],[bl4],[bl5]" + Strings.Replace(str2, ",BL13", "") + ")Or BL13 Is Null) AND ((Words_5Letters1.BL14) Not In ([bl1],[bl2],[bl3],[bl4],[bl5]" + Strings.Replace(str2, ",BL14", "") + ")Or BL14 Is Null) AND ((Words_5Letters1.BL15) Not In ([bl1],[bl2],[bl3],[bl4],[bl5]" + Strings.Replace(str2, ",BL15", "") + ")Or BL15 Is Null)) ";
|
|
modGlobal.conBoggle.Open();
|
|
modGlobal.cmdBog.ExecuteNonQuery();
|
|
modGlobal.conBoggle.Close();
|
|
if (Mode == modFindWords.FindMode.SpecWord)
|
|
{
|
|
if (Strings.InStr(Word, "Q") != 0)
|
|
Word = Strings.Replace(Word, "Q", "QU");
|
|
modGlobal.cmdBog.CommandText = "Select * From Words_5Letters2 Where Instr(Ucase(Word),'" + Word + "') <> 0";
|
|
modGlobal.conBoggle.Open();
|
|
OleDbDataReader oleDbDataReader = modGlobal.cmdBog.ExecuteReader();
|
|
while (oleDbDataReader.Read())
|
|
{
|
|
if (StringType.StrCmp(Strings.UCase(Strings.Mid(StringType.FromObject(oleDbDataReader[nameof (Word)]), 1, Strings.Len(Word))), Word, false) == 0)
|
|
{
|
|
objArray[0] = (object) Strings.Mid(StringType.FromObject(oleDbDataReader[nameof (Word)]), 1, Strings.Len(Word));
|
|
objArray[1] = RuntimeHelpers.GetObjectValue(oleDbDataReader["WordSquares"]);
|
|
}
|
|
}
|
|
if (ObjectType.ObjTst(objArray[0], (object) "", false) == 0)
|
|
{
|
|
objArray[0] = (object) "Not Found";
|
|
objArray[1] = (object) "11111";
|
|
}
|
|
words.Rows.Add(objArray);
|
|
oleDbDataReader.Close();
|
|
modGlobal.conBoggle.Close();
|
|
return words;
|
|
}
|
|
modGlobal.cmdBog.CommandText = "Insert Into Words_4Letters (Word4,WordSquares) SELECT Left([Word],4) AS Word, WordSquares FROM (Words_5Letters2) GROUP BY Left([Word],4),WordSquares";
|
|
modGlobal.conBoggle.Open();
|
|
modGlobal.cmdBog.ExecuteNonQuery();
|
|
modGlobal.conBoggle.Close();
|
|
modGlobal.cmdBog.CommandText = "Insert Into Words_3Letters (Word3,WordSquares) SELECT Left([Word],3) AS Word, WordSquares FROM (Words_5Letters2) GROUP BY Left([Word],3),WordSquares";
|
|
modGlobal.conBoggle.Open();
|
|
modGlobal.cmdBog.ExecuteNonQuery();
|
|
modGlobal.conBoggle.Close();
|
|
modGlobal.cmdBog.CommandText = "INSERT INTO FoundWords ( FoundWord, FoundWordSquares ) SELECT BoggleWords.Word, Max(Words_3Letters.WordSquares) AS MaxOfWordSquares FROM BoggleWords INNER JOIN Words_3Letters ON BoggleWords.Word = Words_3Letters.Word3 GROUP BY BoggleWords.Word";
|
|
modGlobal.conBoggle.Open();
|
|
modGlobal.cmdBog.ExecuteNonQuery();
|
|
modGlobal.conBoggle.Close();
|
|
modGlobal.cmdBog.CommandText = "INSERT INTO FoundWords ( FoundWord, FoundWordSquares ) SELECT BoggleWords.Word, Max(Words_4Letters.WordSquares) AS MaxOfWordSquares FROM BoggleWords INNER JOIN Words_4Letters ON BoggleWords.Word = Words_4Letters.Word4 GROUP BY BoggleWords.Word";
|
|
modGlobal.conBoggle.Open();
|
|
modGlobal.cmdBog.ExecuteNonQuery();
|
|
modGlobal.conBoggle.Close();
|
|
modGlobal.cmdBog.CommandText = "INSERT INTO FoundWords ( FoundWord, FoundWordSquares ) SELECT BoggleWords.Word, Max(Words_5Letters2.WordSquares) AS MaxOfWordSquares FROM BoggleWords INNER JOIN Words_5Letters2 ON BoggleWords.Word = Words_5Letters2.Word GROUP BY BoggleWords.Word";
|
|
modGlobal.conBoggle.Open();
|
|
modGlobal.cmdBog.ExecuteNonQuery();
|
|
modGlobal.conBoggle.Close();
|
|
modGlobal.cmdBog.CommandText = "Select * From FoundWords Order By FoundWord";
|
|
modGlobal.conBoggle.Open();
|
|
OleDbDataReader oleDbDataReader1 = modGlobal.cmdBog.ExecuteReader();
|
|
while (oleDbDataReader1.Read())
|
|
{
|
|
objArray[0] = RuntimeHelpers.GetObjectValue(oleDbDataReader1["FoundWord"]);
|
|
objArray[1] = RuntimeHelpers.GetObjectValue(oleDbDataReader1["FoundWordSquares"]);
|
|
words.Rows.Add(objArray);
|
|
}
|
|
oleDbDataReader1.Close();
|
|
modGlobal.conBoggle.Close();
|
|
return words;
|
|
}
|
|
|
|
public static string GetDef(string Word)
|
|
{
|
|
string def;
|
|
try
|
|
{
|
|
WebResponse response = WebRequest.Create("http://dictionary.reference.com/search?q=" + Word).GetResponse();
|
|
StreamReader streamReader = new StreamReader(response.GetResponseStream(), Encoding.ASCII);
|
|
string end = streamReader.ReadToEnd();
|
|
response.Close();
|
|
streamReader.Close();
|
|
long Start = 1;
|
|
string String1 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ/\\-()?.,[]%! \r\n\t\r";
|
|
string str1 = Strings.Mid(end, Strings.InStr(Strings.UCase(end), "<P><B>" + Strings.UCase(Word) + "</B></P>"));
|
|
while (Start != (long) Strings.Len(str1))
|
|
{
|
|
string str2 = Strings.Mid(str1, checked ((int) Start), 1);
|
|
if (StringType.StrCmp(str2, "<", false) == 0)
|
|
{
|
|
string str3;
|
|
for (; StringType.StrCmp(str2, ">", false) != 0; str2 = Strings.Mid(str1, checked ((int) Start), 1))
|
|
{
|
|
str3 += str2;
|
|
checked { ++Start; }
|
|
}
|
|
str1 = Strings.Replace(str1, str3 + ">", "");
|
|
Start = 0L;
|
|
str3 = "";
|
|
}
|
|
if (Strings.InStr(String1, Strings.UCase(str2)) == 0 & Strings.InStr("<>", str2) == 0)
|
|
{
|
|
str1 = Strings.Replace(str1, str2, "");
|
|
Start = 0L;
|
|
}
|
|
checked { ++Start; }
|
|
}
|
|
long num = 1;
|
|
do
|
|
{
|
|
str1 = Strings.Replace(Strings.Replace(Strings.Replace(str1, StringType.FromLong(num) + ". ", "\r\n" + StringType.FromLong(num) + ". "), StringType.FromLong(num) + ". \r\n", ""), " " + StringType.FromLong(num) + " ", "\r\n" + StringType.FromLong(num) + ". ");
|
|
checked { ++num; }
|
|
}
|
|
while (num <= 500L);
|
|
def = Strings.Mid(str1, 1, checked (Strings.InStr(Strings.UCase(str1), "ADVERTISEMENT") - 1));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ProjectData.SetProjectError(ex);
|
|
if (Information.Err().Number == 5)
|
|
{
|
|
def = "Boggle could not query this defenition from the internet. Make sure you are online and check your internet connection. To disable this option, uncheck \"Enable Defenition Search\" under the \"Options\" menu.";
|
|
ProjectData.ClearProjectError();
|
|
goto label_17;
|
|
}
|
|
else
|
|
ProjectData.ClearProjectError();
|
|
}
|
|
label_17:
|
|
return def;
|
|
}
|
|
|
|
public static string ValidateWords(string Words)
|
|
{
|
|
Words += ",";
|
|
string str;
|
|
while (StringType.StrCmp(Words, "", false) != 0)
|
|
{
|
|
string Word = Strings.Mid(Words, 1, checked (Strings.InStr(Words, ",") - 1));
|
|
Words = Strings.Mid(Words, checked (Strings.InStr(Words, ",") + 1));
|
|
if (ObjectType.ObjTst(modFindWords.FindWords(modFindWords.FindMode.SpecWord, Word).Rows[0][0], (object) "Not Found", false) == 0)
|
|
str = str + Word + ",";
|
|
}
|
|
return str;
|
|
}
|
|
|
|
public enum FindMode
|
|
{
|
|
AllWords,
|
|
SpecWord,
|
|
}
|
|
}
|
|
}
|