Advertisement
DraKiNs

[JS/MSN] NudgeTool Release 2.0

Sep 9th, 2011
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Criado oficialmente por TheGuruSupremacy
  2. // Script Atualizado, Corrigido, Traduzido por Bruno da SIlva
  3. // www.ips-team.blogspot.com
  4.  
  5. var PatchOld = "\x0F\x85\x9E\x00\x00\x00"
  6. var PatchNew = "\xE9\x9F\x00\x00\x00\x90"
  7. var PatchAddress9
  8. var Active = new Boolean();
  9. var ShowToast = new Boolean();
  10. var PatchOldUnlimitedNudge = "\x8B\x86\x60\x03\x00\x00"
  11. var PatchNewUnlimitedNudge = "\x33\xC0\x40\x90\x90\x90";
  12. var PatchIconOld = "\x53"
  13. var PatchIconNew = "\x50"
  14. var AddressIcon
  15. var Address
  16. var delay = new Array()
  17. var NudgesNumber = new Array()
  18. var Installed = new Boolean()
  19. var WNDAbout
  20. var i
  21.  
  22. function OnAboutWNDEvent_CtrlClicked(PlusWnd, ControlId)
  23. {
  24.     WNDAbout = PlusWnd
  25.     if (ControlId == "Button2")
  26.     {
  27.         PlusWnd.Close(1)
  28.     }
  29.     else if (ControlId == "LinkID")
  30.     {
  31.         new ActiveXObject("WScript.Shell").run("http://pastebin.com/Rc6yTtWh")
  32.     }
  33.     else if (ControlId == "Button3")
  34.     {
  35.         new ActiveXObject("WScript.Shell").run("http://pastebin.com/Rc6yTtWh")
  36.     }
  37. }
  38.  
  39. function OnNDSOptionsEvent_CtrlClicked(PlusWnd, ControlId)
  40. {
  41.     if (ControlId == "BtnOk")
  42.     {
  43.         var oShell = new ActiveXObject("WScript.Shell")
  44.         if (PlusWnd.Button_IsChecked("ShowToast") == true)
  45.         {
  46.             oShell.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\ShowToast", true & 1, "REG_DWORD");
  47.         }
  48.         else if (PlusWnd.Button_IsChecked("ShowToast") == false)
  49.         {
  50.             oShell.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\ShowToast", false & 1, "REG_DWORD");
  51.         }
  52.         PlusWnd.Close(1)
  53.     }
  54. }
  55.  
  56. function GetTempPath()
  57. {
  58.     var sBuffer = Interop.Allocate((260 + 1) * 2);
  59.     Interop.Call('kernel32', 'GetTempPathW', 100, sBuffer);
  60.     return sBuffer.ReadString(0);
  61. }
  62.  
  63. function DownloadFile(FileName)
  64. {
  65.     try
  66.     {
  67.         var Path = GetTempPath() + "\\NDS.plsc"
  68.         Debug.Trace(Path)
  69.         MsgPlus.DownloadFile(FileName, Path)
  70.     }
  71.     catch (exception)
  72.     {
  73.         MsgPlus.DisplayToast("NudgesToolsSCRIPT", exception)
  74.     }
  75. }
  76.  
  77. function OnEvent_DownloadFileComplete(Url, OutFile, Success)
  78. {
  79.     if (Url == "http://pastebin.com/Rc6yTtWh")
  80.     {
  81.         if (Success == true)
  82.         {
  83.             try
  84.             {
  85.                 Debug.Trace("Instalando ..")
  86.                 Interop.Call('shell32', 'ShellExecuteW', 0, 'open', OutFile, '', '', 1)
  87.             }
  88.             catch (exception)
  89.             {
  90.                 MsgPlus.DisplayToast("NudgesToolsSCRIPT", exception)
  91.             }
  92.         }
  93.     }
  94. }
  95.  
  96. function OnEvent_Initialize(bMessengerStart)
  97. {
  98.     if (Messenger.MyStatus > 0) OnEvent_Signin();
  99. }
  100.  
  101. function OnEvent_Signin(sEmail)
  102. {
  103.     PatchAddress9=[0x562E3E,0x564266,0x564A4F,0x4FACB7]
  104.     Address=[0x562EE2,0x56430A,0x564AF3,0x5647EC]
  105.     if (Messenger.Version <= 8.5)
  106.     {
  107.         MsgPlus.DisplayToast("NudgesTools", "NudgesToolsScript 2.0 não é compactível com sua versão atual do msn", "", "Nova Versao", "http://pastebin.com/Rc6yTtWh")
  108.         return ""
  109.     }
  110. else if(Messenger.VersionBuild==8050){i=0}else if(Messenger.VersionBuild==8064){i=1}else if(Messenger.VersionBuild==8089){i=2}else if(Messenger.VersionBuild==8117){i=3}
  111.     Installed = true
  112.     var oShell = new ActiveXObject("WScript.Shell");
  113.     var hProc = Interop.Call("Kernel32", "GetCurrentProcess");
  114.     var Handle = Interop.Call("Kernel32", "GetModuleHandleW", null)
  115.     Debug.Trace(Handle.toString(16))
  116.     Address[i] = (Address[i] - 0x00400000) + Handle
  117.     AddressIcon[i] = (AddressIcon[i] - 0x00400000) + Handle
  118.     PatchAddress9[i] = (PatchAddress9[i] - 0x00400000) + Handle
  119.     Debug.Trace(Address[i])
  120.     var sBuffer = Interop.Allocate(PatchOld.length);
  121.     Interop.Call("Kernel32", "ReadProcessMemory", hProc, PatchAddress9[i], sBuffer.DataPtr, PatchOld.length, 0);
  122.     var sReturn = "";
  123.     for (var j = 0; j < sBuffer.size; j++) sReturn += String.fromCharCode(sBuffer.GetAt(j) & 0xFF);
  124.     Debug.Trace(sReturn)
  125.     if (sReturn === PatchOld || sReturn === PatchNew)
  126.     {
  127.         try
  128.         {
  129.             Active = Boolean(oShell.RegRead(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\NudgesTools"));
  130.         }
  131.         catch (exception)
  132.         {
  133.             Active = false;
  134.         }
  135.         if (Active == false)
  136.         {
  137.             Patch(PatchAddress9[i], PatchOld)
  138.             Patch(Address[i], PatchOldUnlimitedNudge)
  139.             Patch(AddressIcon[i], PatchIconOld)
  140.         }
  141.         else
  142.         {
  143.             Patch(PatchAddress9[i], PatchNew)
  144.             Patch(Address[i], PatchNewUnlimitedNudge)
  145.             Patch(AddressIcon[i], PatchIconNew)
  146.         }
  147.         oShell.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\NudgesTools", Active & 1, "REG_DWORD");
  148.         try
  149.         {
  150.             ShowToast = Boolean(oShell.RegRead(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\ShowToast"));
  151.         }
  152.         catch (exception)
  153.         {
  154.             ShowToast = false;
  155.             Installed = false
  156.         }
  157.         if (Installed == false)
  158.         {
  159.             oShell.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\ShowToast", true & 1, "REG_DWORD");
  160.             MsgPlus.DisplayToast("NudgesTools", "Nudges Tools Script " + (Active ? "Ativado" : "Disabled"));
  161.         }
  162.         if (ShowToast != false)
  163.         {
  164.             MsgPlus.DisplayToast("NudgesTools", "Nudges Tools Script " + (Active ? "Ativado" : "Disabled"));
  165.         }
  166.         return;
  167.     }
  168.     Address = 0
  169.     MsgPlus.DisplayToast("NudgesTools", "Windows Live Messenger " + Messenger.Version.toFixed(1) + ".0" + Messenger.VersionBuild + "\n não é suportado");
  170. }
  171.  
  172. function OnGetScriptMenu(nLocation)
  173. {
  174.     if (Address !== 0) return "<ScriptMenu>" + "<MenuEntry Id=\"MnuNudgesTools\">" + (Active ? "Desativado" : "Ativado") + "</MenuEntry>" + "<MenuEntry Id=\"MnuNudgesToolsOption\">" + ("Opções") + "</MenuEntry>" + "<MenuEntry Id=\"MnuNudgesToolsAbout\">" + ("Sobre") + "</MenuEntry>" + "</ScriptMenu>";
  175. }
  176.  
  177. function OnGetScriptCommands()
  178. {
  179.     var commands = "<ScriptCommands>";
  180.     commands += "  <Command>"
  181.     commands += "    <Name>sendnudge</Name>"
  182.     commands += "    <Description>Enviar atenções automáticamente</Description>"
  183.     commands += "  </Command>"
  184.     commands += "  <Command>"
  185.     commands += "    <Name>stopnudge</Name>"
  186.     commands += "    <Description>Para de enviar as atenções</Description>"
  187.     commands += "  </Command>"
  188.     commands += "</ScriptCommands>"
  189.     return commands;
  190. }
  191.  
  192. function OnEvent_ChatWndSendMessage(ChatWnd, Message)
  193. {
  194.     if (Message == "/stopnudge")
  195.     {
  196.         NudgesNumber[ChatWnd.Handle] = 0
  197.         return "";
  198.     }
  199.     var Splitter = Message.substring(11, Message.length)
  200.     if (Message.substring(0, 10) == "/sendnudge")
  201.     {
  202.         if (Active == false)
  203.         {
  204.             Interop.Call("user32", "MessageBoxW", null, "Nudges Tool encontra-se desabilitado, olhe as configurações", "Okay", 0)
  205.             return ""
  206.         }
  207.         else
  208.         {
  209.             Splitter = Splitter.split(" ")
  210.             if (Splitter[1] != null)
  211.             {
  212.                 delay[ChatWnd.Handle] = Splitter[1]
  213.             }
  214.             else
  215.             {
  216.                 delay[ChatWnd.Handle] = 1000
  217.             }
  218.             NudgesNumber[ChatWnd.Handle] = Splitter[0]
  219.             MsgPlus.AddTimer(ChatWnd.Handle, delay[ChatWnd.Handle])
  220.             return "";
  221.         }
  222.     }
  223. }
  224.  
  225. function Enable()
  226. {
  227.     var oShell = new ActiveXObject("WScript.Shell")
  228.     if (Active == true)
  229.     {
  230.         Patch(Address[i], PatchOldUnlimitedNudge)
  231.         Patch(PatchAddress9[i], (Active = !Active) ? PatchNew : PatchOld)
  232.         Patch(AddressIcon[i], PatchIconOld)
  233.     }
  234.     else if (Active == false)
  235.     {
  236.         Patch(Address[i], PatchNewUnlimitedNudge)
  237.         Patch(PatchAddress9[i], (Active = !Active) ? PatchNew : PatchOld)
  238.         Patch(AddressIcon[i], PatchIconNew)
  239.     }
  240.     oShell.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\NudgesTools", Active & 1, "REG_DWORD");
  241.     MsgPlus.DisplayToast("NudgesTools", "Nudges Tools Script " + (Active ? "Enabled" : "Disabled"));
  242. }
  243.  
  244. function OnEvent_MenuClicked(sMenuId, nLocation, iOriginWnd)
  245. {
  246.     if (sMenuId == "MnuNudgesToolsOption")
  247.     {
  248.         ShowOptionsWindow()
  249.     }
  250.     else if (sMenuId == "MnuNudgesToolsAbout")
  251.     {
  252.         var WindowOptions = MsgPlus.CreateWnd("About.xml", "AboutWND")
  253.     }
  254.     else
  255.     {
  256.         Enable()
  257.     }
  258. }
  259.  
  260. function Patch(nAddress, sByteString)
  261. {
  262.     var sBuffer = Interop.Allocate(++sByteString.length);
  263.     for (var j = 0; j < sByteString.length; j++) sBuffer.WriteWORD(j, sByteString.charCodeAt(j));
  264.     var hProc = Interop.Call("Kernel32", "GetCurrentProcess");
  265.     Interop.Call("Kernel32", "WriteProcessMemory", hProc, nAddress, sBuffer.DataPtr, sByteString.length, 0);
  266. }
  267.  
  268. function ShowOptionsWindow()
  269. {
  270.     var oShell = new ActiveXObject("WScript.Shell")
  271.     var WindowOptions = MsgPlus.CreateWnd("Options.xml", "NDSOptions")
  272.     var Show = new Boolean()
  273.     Show = Boolean(oShell.RegRead(MsgPlus.ScriptRegPath + Messenger.MyUserId + "\\ShowToast"));
  274.     if (Show == true)
  275.     {
  276.         WindowOptions.Button_SetCheckState("ShowToast", true)
  277.     }
  278. }
  279.  
  280. function OnEvent_Timer(Timerid)
  281. {
  282.     var ChatWnd
  283.     var WMCOMMAND = 273
  284.     for (var e = new Enumerator(Messenger.CurrentChats); !e.atEnd(); e.moveNext())
  285.     {
  286.         var ChatWindow = e.item();
  287.         if (ChatWindow.Handle == Timerid)
  288.         {
  289.             ChatWnd = ChatWindow
  290.             break
  291.         }
  292.     }
  293.     if (ChatWnd != null)
  294.     {
  295.         if (NudgesNumber[Timerid] == 0)
  296.         {}
  297.         else
  298.         {
  299.             var Window = ChatWnd.Handle
  300.             Interop.Call("user32", "SendMessageW", Window, WMCOMMAND, 689, 0)
  301.             NudgesNumber[Timerid]--MsgPlus.AddTimer(Timerid, delay[ChatWnd.Handle])
  302.         }
  303.     }
  304.     else
  305.     {
  306.         delete NudgesNumber[Timerid];
  307.         delete delay[ChatWnd.Handle];
  308.     }
  309. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement