breaking the bonds storyline

This commit is contained in:
Michael 2017-06-24 14:41:45 -04:00
parent 1661f9a5bd
commit 8621b3ddff
9 changed files with 165 additions and 53 deletions

View file

@ -55,11 +55,14 @@ namespace ShiftOS.WinForms.Applications
public static void DisconnectRemote()
{
OnDisconnect?.Invoke();
CurrentRemoteUser = new Objects.ClientSave();
if (!string.IsNullOrWhiteSpace(OpenConnection.SystemName))
Infobox.Show("Connections terminated.", "All outbound File Skimmer connections have been terminated.");
OpenConnection = new ShiftOSEnvironment();
Desktop.InvokeOnWorkerThread(() =>
{
OnDisconnect?.Invoke();
CurrentRemoteUser = new Objects.ClientSave();
if (!string.IsNullOrWhiteSpace(OpenConnection.SystemName))
Infobox.Show("Connections terminated.", "All outbound File Skimmer connections have been terminated.");
OpenConnection = new ShiftOSEnvironment();
});
}
public FileSkimmer()

View file

@ -49,7 +49,10 @@ namespace ShiftOS.Engine
[Command("clear", description = "{DESC_CLEAR}")]
public static bool Clear()
{
AppearanceManager.ConsoleOut.Clear();
Desktop.InvokeOnWorkerThread(() =>
{
AppearanceManager.ConsoleOut.Clear();
});
return true;
}
}

View file

@ -359,6 +359,16 @@ namespace ShiftOS.WinForms.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] brute {
get {
object obj = ResourceManager.GetObject("brute", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View file

@ -34618,6 +34618,9 @@
<data name="strings_fr" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\strings_fr.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="brute" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\brute.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="PebcakDevelFS" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\PebcakDevelFS.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>

Binary file not shown.

View file

@ -873,6 +873,7 @@
<None Include="Resources\Ambient8.mp3" />
<None Include="Resources\Ambient9.mp3" />
<None Include="Resources\austmicrotrends.png" />
<None Include="Resources\brute.mp3" />
<Content Include="Resources\fileiconcf.bmp" />
<None Include="Resources\infobox.wav" />
<None Include="Resources\typesound.wav" />

View file

@ -163,6 +163,20 @@ namespace ShiftOS.WinForms.Stories
}
VirtualEnvironments.Clear();
Applications.FileSkimmer.DisconnectRemote();
WriteLine("Connections terminated I see.. Alright. Have fun with those dummy documents - you can keep them if you'd like. There's nothing important in them.");
WriteLine("That's one thing you can do with brute and other hacking utilities. I'd recommend buying some of brute's Shiftorium upgrades to make it faster and more efficient.");
WriteLine("Also, along the way, you're going to find a lot of new tricks. Some of them will require more than just brute to get into.");
WriteLine("So be on the lookout on the Shiftnet for other hacking-related tools. You won't find any on Appscape, however...");
WriteLine("That darn Aiden Nirh guy can't stand hackers.");
WriteLine("Looking at your logs, I see he's contacted you before... Seriously... don't let him find out about brute. He'll report it directly to DevX.");
WriteLine("Oh yeah, one more thing... that virus scanner... you may want to scan any files that you transfer from other systems with it.");
WriteLine("You never know what sorts of digital filth is hidden within such innocent-looking files.");
WriteLine("ALWAYS scan before opening - because if you open a file containing malicious code, it'll get run. It's just how ShiftOS's kernel works.");
Console.WriteLine("User has disconnected.");
Story.Context.MarkComplete();
TerminalBackend.PrefixEnabled = true;
SaveSystem.SaveGame();
TerminalBackend.PrintPrompt();
});
});
}
@ -173,6 +187,8 @@ namespace ShiftOS.WinForms.Stories
//just to annoy victor tran
}
const string VALID_PASSWORD_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_";
public static string GenRandomPassword()
{
var rnd = new Random();
@ -180,7 +196,8 @@ namespace ShiftOS.WinForms.Stories
string pass = "";
for(int i = 0; i < len; i++)
{
pass += (char)rnd.Next(255);
char c = VALID_PASSWORD_CHARS[rnd.Next(VALID_PASSWORD_CHARS.Length)];
pass += c;
}
return pass;
}

View file

@ -2,7 +2,9 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using ShiftOS.Engine;
namespace ShiftOS.WinForms
{
@ -27,6 +29,113 @@ namespace ShiftOS.WinForms
_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);

View file

@ -83,28 +83,15 @@ namespace ShiftOS.Engine
/// <param name="file">The file to play.</param>
public static void Play(string file)
{
bool play = true;
float volume = 1f;
if (SaveSystem.CurrentSave != null)
try
{
play = (SaveSystem.CurrentSave.SoundEnabled);
volume = (float)SaveSystem.CurrentSave.MusicVolume / 100f;
var bytes = File.ReadAllBytes(file);
var str = new MemoryStream(bytes);
PlayStream(str);
}
if (play)
catch
{
try
{
_reader = new AudioFileReader(file);
_out = new WaveOut();
_out.Init(_reader);
_out.Volume = volume;
_out.Play();
_out.PlaybackStopped += (o, a) => { PlayCompleted?.Invoke(); };
}
catch (Exception ex)
{
Console.WriteLine("Audio error: " + ex.Message);
}
}
}
@ -114,35 +101,14 @@ namespace ShiftOS.Engine
/// <param name="str">The stream to read from.</param>
public static void PlayStream(Stream str)
{
try
bool play = true;
if (SaveSystem.CurrentSave != null)
play = SaveSystem.CurrentSave.SoundEnabled;
if (play)
{
bool play = true;
float volume = 1f;
if (SaveSystem.CurrentSave != null)
{
play = (SaveSystem.CurrentSave.SoundEnabled);
volume = (float)SaveSystem.CurrentSave.MusicVolume / 100f;
}
if (play)
{
try
{
while (_out.PlaybackState == PlaybackState.Playing)
{
Thread.Sleep(10);
}
}
catch { }
ShiftOS.Engine.AudioManager.Stop();
_out = new WaveOut();
var mp3 = new WaveFileReader(str);
_out.Init(mp3);
_out.Volume = volume;
_out.Play();
_out.PlaybackStopped += (o, a) => { PlayCompleted?.Invoke(); };
}
var splayer = new System.Media.SoundPlayer(str);
splayer.Play();
}
catch { }
}
public static event Action PlayCompleted;