MalwareSourceCode/MSIL/Virus/Win32/S/Virus.Win32.Sality.sil-9eb937e4a3faa7c29e8cc85118a5c87d65f8716c89e5d1b13d7d7bc334ec8975/_0001/_0004.cs
2022-08-18 06:28:56 -05:00

245 lines
6.3 KiB
C#
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Decompiled with JetBrains decompiler
// Type: .
// Assembly: a5b7ee8e-cbdf-4eff-9144-efd0c433f3fe, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 97CE9FDF-0921-44CB-AE13-1E9A2A550F0F
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Virus.Win32.Sality.sil-9eb937e4a3faa7c29e8cc85118a5c87d65f8716c89e5d1b13d7d7bc334ec8975.exe
using \u0001;
using SmartAssembly.SmartExceptionsCore;
using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
namespace \u0001
{
internal static class \u0004
{
private static ModuleHandle \u0001;
private static char[] \u0001;
public static void \u0003([In] int obj0)
{
Type typeFromHandle;
FieldInfo[] fields;
int index1;
FieldInfo fieldInfo;
string name;
bool flag;
int num1;
int index2;
char ch;
int index3;
MethodInfo methodFromHandle;
Delegate @delegate;
ParameterInfo[] parameters;
int length;
Type[] parameterTypes;
int index4;
DynamicMethod dynamicMethod;
ILGenerator ilGenerator;
int num2;
try
{
try
{
typeFromHandle = Type.GetTypeFromHandle(\u0004.\u0001.ResolveTypeHandle(33554433 + obj0));
}
catch
{
return;
}
fields = typeFromHandle.GetFields(BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetField);
for (index1 = 0; index1 < fields.Length; ++index1)
{
fieldInfo = fields[index1];
name = fieldInfo.Name;
flag = false;
num1 = 0;
for (index2 = name.Length - 1; index2 >= 0; --index2)
{
ch = name[index2];
if (ch == '~')
{
flag = true;
break;
}
for (index3 = 0; index3 < 58; ++index3)
{
if ((int) \u0004.\u0001[index3] == (int) ch)
{
num1 = num1 * 58 + index3;
break;
}
}
}
try
{
methodFromHandle = (MethodInfo) MethodBase.GetMethodFromHandle(\u0004.\u0001.ResolveMethodHandle(num1 + 167772161));
}
catch
{
continue;
}
if (methodFromHandle.IsStatic)
{
try
{
@delegate = Delegate.CreateDelegate(fieldInfo.FieldType, methodFromHandle);
}
catch (Exception ex)
{
continue;
}
}
else
{
parameters = methodFromHandle.GetParameters();
length = parameters.Length + 1;
parameterTypes = new Type[length];
parameterTypes[0] = typeof (object);
for (index4 = 1; index4 < length; ++index4)
parameterTypes[index4] = parameters[index4 - 1].ParameterType;
dynamicMethod = new DynamicMethod(string.Empty, methodFromHandle.ReturnType, parameterTypes, typeFromHandle, true);
ilGenerator = dynamicMethod.GetILGenerator();
ilGenerator.Emit(OpCodes.Ldarg_0);
if (length > 1)
ilGenerator.Emit(OpCodes.Ldarg_1);
if (length > 2)
ilGenerator.Emit(OpCodes.Ldarg_2);
if (length > 3)
ilGenerator.Emit(OpCodes.Ldarg_3);
if (length > 4)
{
for (num2 = 4; num2 < length; ++num2)
ilGenerator.Emit(OpCodes.Ldarg_S, num2);
}
ilGenerator.Emit(flag ? OpCodes.Callvirt : OpCodes.Call, methodFromHandle);
ilGenerator.Emit(OpCodes.Ret);
try
{
@delegate = dynamicMethod.CreateDelegate(typeFromHandle);
}
catch
{
continue;
}
}
try
{
fieldInfo.SetValue((object) null, (object) @delegate);
}
catch
{
}
}
}
catch (Exception ex)
{
object[] objArray = new object[20]
{
(object) typeFromHandle,
(object) fieldInfo,
(object) name,
(object) flag,
(object) num1,
(object) index2,
(object) ch,
(object) index3,
(object) methodFromHandle,
(object) @delegate,
(object) parameters,
(object) length,
(object) parameterTypes,
(object) index4,
(object) dynamicMethod,
(object) ilGenerator,
(object) num2,
(object) fields,
(object) index1,
(object) obj0
};
throw UnhandledException.\u0003(ex, objArray);
}
}
static \u0004()
{
Type type1;
try
{
\u0004.\u0001 = new char[58]
{
'\u0001',
'\u0002',
'\u0003',
'\u0004',
'\u0005',
'\u0006',
'\a',
'\b',
'\u000E',
'\u000F',
'\u0010',
'\u0011',
'\u0012',
'\u0013',
'\u0014',
'\u0015',
'\u0016',
'\u0017',
'\u0018',
'\u0019',
'\u001A',
'\u001B',
'\u001C',
'\u001D',
'\u001E',
'\u001F',
'\u007F',
'\u0080',
'\u0081',
'\u0082',
'\u0083',
'\u0084',
'\u0086',
'\u0087',
'\u0088',
'\u0089',
'\u008A',
'\u008B',
'\u008C',
'\u008D',
'\u008E',
'\u008F',
'\u0090',
'\u0091',
'\u0092',
'\u0093',
'\u0094',
'\u0095',
'\u0096',
'\u0097',
'\u0098',
'\u0099',
'\u009A',
'\u009B',
'\u009C',
'\u009D',
'\u009E',
'\u009F'
};
type1 = typeof (MulticastDelegate);
if ((object) type1 == null)
return;
\u0004.\u0001 = Assembly.GetExecutingAssembly().GetModules()[0].ModuleHandle;
}
catch (Exception ex)
{
Type type2 = type1;
throw UnhandledException.\u0003(ex, (object) type2);
}
}
}
}