blob: fb3956989f47b091f8662a4ec164e59bcf475597 (
plain) (
blame)
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
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using ShiftOS.Engine;
namespace ShiftOS.WinForms
{
public static class VirtualEnvironments
{
private static List<ShiftOSEnvironment> _environments = new List<ShiftOSEnvironment>();
public static void Create(string sysname, List<ShiftOS.Objects.ClientSave> users, ulong cp, ShiftOS.Objects.ShiftFS.Directory fs)
{
var env = new ShiftOSEnvironment
{
SystemName = sysname,
Users = users,
Codepoints = cp,
Filesystem = fs
};
_environments.Add(env);
}
public static void Clear()
{
_environments.Clear();
}
const string VALID_PASSWORD_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_";
[RequiresUpgrade("brute")]
[Command("brute")]
public static void Brute()
{
TerminalBackend.PrefixEnabled = false;
bool cracked = false;
var brute = Properties.Resources.brute;
var str = new System.IO.MemoryStream(brute);
var reader = new NAudio.Wave.Mp3FileReader(str);
var _out = new NAudio.Wave.WaveOut();
_out.Init(reader);
_out.PlaybackStopped += (o, a) =>
{
if (cracked == false)
{
cracked = true;
TerminalCommands.Clear();
ConsoleEx.Bold = true;
ConsoleEx.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(" - access denied - ");
ConsoleEx.ForegroundColor = ConsoleColor.Gray;
ConsoleEx.Bold = false;
ConsoleEx.Italic = true;
Console.WriteLine("password could not be cracked before connection termination.");
}
TerminalBackend.PrefixEnabled = true;
TerminalBackend.PrintPrompt();
_out.Dispose();
reader.Dispose();
str.Dispose();
};
_out.Play();
var t = new Thread(() =>
{
Console.WriteLine("brute - version 1.0");
Console.WriteLine("Copyright (c) 2018 hacker101. All rights reserved.");
Console.WriteLine();
Thread.Sleep(4000);
Console.WriteLine("Scanning outbound connections...");
if (string.IsNullOrWhiteSpace(Applications.FileSkimmer.OpenConnection.SystemName))
{
Thread.Sleep(2000);
Console.WriteLine(" - no outbound connections to scan, aborting - ");
_out.Stop();
_out.Dispose();
reader.Dispose();
str.Dispose();
}
else
{
Thread.Sleep(2000);
var con = Applications.FileSkimmer.OpenConnection;
Console.WriteLine($@"{con.SystemName}
------------------
Active connection: ftp, rts
System name: {con.SystemName}
Users: {con.Users.Count}");
Thread.Sleep(500);
var user = con.Users.FirstOrDefault(x => x.Permissions == Objects.UserPermissions.Root);
if (user == null)
Console.WriteLine(" - no users found with root access - this is a shiftos bug - ");
else
{
Console.WriteLine(" - starting bruteforce attack on user: " + user.Username + " - ");
var rnd = new Random();
char[] pass = new char[user.Password.Length];
for (int i = 0; i < pass.Length; i++)
{
if (cracked == true)
break;
while (pass[i] != user.Password[i])
{
if (cracked == true)
break;
char c = VALID_PASSWORD_CHARS[rnd.Next(VALID_PASSWORD_CHARS.Length)];
if (char.IsLetterOrDigit(c))
{
pass[i] = c;
Console.WriteLine(new string(pass));
Console.WriteLine();
Thread.Sleep(1);
}
}
}
if (cracked == false)
{
cracked = true;
TerminalCommands.Clear();
Console.WriteLine(" - credentials cracked. -");
Console.WriteLine($@"sysname: {con.SystemName}
user: {user.Username}
password: {user.Password}");
}
}
}
});
t.Start();
}
public static ShiftOSEnvironment Get(string sysname)
{
return _environments.FirstOrDefault(x => x.SystemName == sysname);
}
}
public class ShiftOSEnvironment
{
public string SystemName { get; set; }
public ulong Codepoints { get; set; }
public ShiftOS.Objects.ShiftFS.Directory Filesystem { get; set; }
public List<ShiftOS.Objects.ClientSave> Users { get; set; }
}
}
|