-
Notifications
You must be signed in to change notification settings - Fork 2
/
HTTPExploitExe.cs
189 lines (172 loc) · 6.86 KB
/
HTTPExploitExe.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Hacknet
{
// Token: 0x02000123 RID: 291
internal class HTTPExploitExe : ExeModule
{
// Token: 0x060006DD RID: 1757 RVA: 0x000715E8 File Offset: 0x0006F7E8
public HTTPExploitExe(Rectangle location, OS operatingSystem) : base(location, operatingSystem)
{
this.needsProxyAccess = true;
this.ramCost = 208;
this.IdentifierName = "Apache Web Server Worm";
}
// Token: 0x060006DE RID: 1758 RVA: 0x0007165C File Offset: 0x0006F85C
public override void LoadContent()
{
base.LoadContent();
this.graphPoints = new List<Vector2>();
this.backGraphPoints = new List<Vector2>();
float num = 6f;
this.heightRange = (float)((this.bounds.Height - 4 - 17) / 3) * 2f;
int num2 = (int)((float)(this.bounds.Width - 4) / num);
Vector2 vector = new Vector2(2f, (float)(this.bounds.Height - 4 - 17));
this.graphPoints.Add(new Vector2(vector.X, vector.Y));
this.backGraphPoints.Add(new Vector2(vector.X, vector.Y));
for (int i = 1; i < num2 - 1; i++)
{
this.graphPoints.Add(new Vector2(vector.X, vector.Y - (float)((Utils.random.NextDouble() * 0.2 + 0.3) * (double)this.heightRange)));
this.backGraphPoints.Add(new Vector2(vector.X, vector.Y - (float)(Utils.random.NextDouble() * (double)this.heightRange)));
vector.X += num;
}
this.graphPoints.Add(new Vector2(vector.X, vector.Y));
this.backGraphPoints.Add(new Vector2(vector.X, vector.Y));
Computer computer = Programs.getComputer(this.os, this.targetIP);
if (computer != null)
{
computer.hostileActionTaken();
}
}
// Token: 0x060006DF RID: 1759 RVA: 0x00071824 File Offset: 0x0006FA24
public override void Update(float t)
{
base.Update(t);
Rectangle rectangle = new Rectangle(this.bounds.X + 1, this.bounds.Y + Module.PANEL_HEIGHT + 1, this.bounds.Width - 2, this.bounds.Height - Module.PANEL_HEIGHT - 2);
this.heightRange = (float)((rectangle.Height - 4 - 17) / 3) * 2f;
float y = Math.Max(1f, (float)rectangle.Height - 4f - 17f);
this.graphPoints[0] = new Vector2(this.graphPoints[0].X, y);
this.backGraphPoints[0] = new Vector2(this.backGraphPoints[0].X, y);
this.graphPoints[this.graphPoints.Count - 1] = new Vector2(this.graphPoints[this.graphPoints.Count - 1].X, y);
this.backGraphPoints[this.backGraphPoints.Count - 1] = new Vector2(this.backGraphPoints[this.backGraphPoints.Count - 1].X, y);
this.progress += t / HTTPExploitExe.DURATION;
if (this.progress >= 1f)
{
this.progress = 1f;
if (!this.hasCompleted)
{
this.Completed();
this.hasCompleted = true;
}
this.sucsessTimer -= t;
if (this.sucsessTimer <= 0f)
{
this.isExiting = true;
}
}
else
{
this.tAccum += t * 1.5f;
this.fastTimeAccum += t * 4f;
}
for (int i = 1; i < this.graphPoints.Count - 1; i++)
{
Vector2 value = this.graphPoints[i];
float num = Math.Abs(value.Y - this.heightRange / 2f);
num /= this.heightRange / 2f;
num *= num;
float num2 = 30f - num;
num *= (1f - this.progress) * num2 + this.progress * 30f;
value.Y += (float)(Math.Sin((double)(this.fastTimeAccum + (float)(i * rectangle.Width))) * (double)HTTPExploitExe.GRAPH_MOVEMENT * (double)num * (double)t);
value.Y = Math.Min(value.Y, (float)rectangle.Height);
value.Y = Math.Max(value.Y, 0f);
this.graphPoints[i] = value;
value = this.backGraphPoints[i];
num = this.heightRange / 2f - Math.Abs(value.Y - this.heightRange / 2f);
value.Y += (float)(Math.Sin((double)(this.tAccum + (float)(i * rectangle.Width))) * (double)HTTPExploitExe.GRAPH_MOVEMENT * (double)num * (double)t);
this.backGraphPoints[i] = value;
}
}
// Token: 0x060006E0 RID: 1760 RVA: 0x00071BA0 File Offset: 0x0006FDA0
public override void Draw(float t)
{
base.Draw(t);
this.drawOutline();
this.drawTarget("app:");
Rectangle rectangle = this.bounds;
Rectangle bounds = this.bounds;
rectangle = new Rectangle(this.bounds.X + 1, this.bounds.Y + Module.PANEL_HEIGHT + 1, this.bounds.Width - 2, this.bounds.Height - Module.PANEL_HEIGHT - 2);
rectangle = (this.bounds = rectangle);
Vector2 value = new Vector2((float)this.bounds.X, (float)this.bounds.Y);
for (int i = 0; i < this.graphPoints.Count - 1; i++)
{
Vector2 value2 = this.backGraphPoints[i];
Vector2 value3 = this.backGraphPoints[i + 1];
value2.Y = Math.Min(value2.Y, (float)this.bounds.Height);
value2.Y = Math.Max(value2.Y, 0f);
value3.Y = Math.Min(value3.Y, this.heightRange);
value3.Y = Math.Max(value3.Y, 0f);
this.drawLine(value2 + value, value3 + value, this.os.subtleTextColor);
}
for (int i = 0; i < this.graphPoints.Count - 1; i++)
{
this.drawLine(this.graphPoints[i] + value, this.graphPoints[i + 1] + value, Color.White);
}
rectangle.X += 2;
rectangle.Width -= 4;
rectangle.Y = this.bounds.Y + this.bounds.Height - 1 - 13;
rectangle.Height = 13;
this.spriteBatch.Draw(Utils.white, rectangle, this.os.outlineColor * this.fade);
rectangle.X++;
rectangle.Y++;
rectangle.Width -= 2;
rectangle.Height -= 2;
this.spriteBatch.Draw(Utils.white, rectangle, Color.White * this.fade);
rectangle.Width = (int)((float)rectangle.Width * this.progress);
this.spriteBatch.Draw(Utils.white, rectangle, this.os.highlightColor * this.fade);
this.bounds = bounds;
}
// Token: 0x060006E1 RID: 1761 RVA: 0x00071E84 File Offset: 0x00070084
public void drawLine(Vector2 origin, Vector2 dest, Color c)
{
float y = Vector2.Distance(origin, dest);
float num = (float)Math.Atan2((double)(dest.Y - origin.Y), (double)(dest.X - origin.X));
num += 4.712389f;
this.spriteBatch.Draw(Utils.white, origin, null, c * this.fade, num, Vector2.Zero, new Vector2(1f, y), SpriteEffects.None, 0.5f);
}
// Token: 0x060006E2 RID: 1762 RVA: 0x00071F08 File Offset: 0x00070108
public override void Completed()
{
base.Completed();
Computer computer = Programs.getComputer(this.os, this.targetIP);
if (computer != null)
{
computer.openPort(80, this.os.thisComputer.ip);
}
}
// Token: 0x040007B0 RID: 1968
public static float DURATION = 14f;
// Token: 0x040007B1 RID: 1969
public static float AFTER_COMPLETION_STALL = 1f;
// Token: 0x040007B2 RID: 1970
public static float GRAPH_MOVEMENT = 22f;
// Token: 0x040007B3 RID: 1971
private float progress = 0f;
// Token: 0x040007B4 RID: 1972
private bool hasCompleted = false;
// Token: 0x040007B5 RID: 1973
private float sucsessTimer = HTTPExploitExe.AFTER_COMPLETION_STALL;
// Token: 0x040007B6 RID: 1974
private float tAccum = 0f;
// Token: 0x040007B7 RID: 1975
private float fastTimeAccum = 0f;
// Token: 0x040007B8 RID: 1976
private float heightRange = 0f;
// Token: 0x040007B9 RID: 1977
private List<Vector2> graphPoints;
// Token: 0x040007BA RID: 1978
private List<Vector2> backGraphPoints;
}
}