Ejemplo n.º 1
0
 public UserDetail(string user)
 {
     this.name  = user;
     this.pass  = PortExploits.getRandomPassword();
     this.type  = (byte)1;
     this.known = false;
 }
Ejemplo n.º 2
0
 public UserDetail(string user)
 {
     name  = user;
     pass  = PortExploits.getRandomPassword();
     type  = 1;
     known = false;
 }
Ejemplo n.º 3
0
        public override void disconnectionDetected(Computer c, OS os)
        {
            base.disconnectionDetected(c, os);
            double time = 20.0 * Utils.random.NextDouble();

            os.delayer.Post(ActionDelayer.Wait(time), (Action)(() =>
            {
                if (os.connectedComp != null && !(os.connectedComp.ip != c.ip))
                {
                    return;
                }
                for (int index = 0; index < c.ports.Count; ++index)
                {
                    c.closePort(c.ports[index], "LOCAL_ADMIN");
                }
                if (this.ResetsPassword)
                {
                    c.setAdminPassword(PortExploits.getRandomPassword());
                }
                c.adminIP = c.ip;
                if (c.firewall != null)
                {
                    c.firewall.solved = false;
                    c.firewall.resetSolutionProgress();
                }
            }));
        }
Ejemplo n.º 4
0
        public override void disconnectionDetected(Computer c, OS os)
        {
            base.disconnectionDetected(c, os);
            for (var index = 0; index < c.ports.Count; ++index)
            {
                c.closePort(c.ports[index], "LOCAL_ADMIN");
            }
            if (c.firewall != null)
            {
                c.firewall.resetSolutionProgress();
                c.firewall.solved = false;
            }
            if (c.hasProxy)
            {
                c.proxyActive        = true;
                c.proxyOverloadTicks = c.startingOverloadTicks;
            }
            var    time   = 20.0 * Utils.random.NextDouble();
            Action action = () =>
            {
                if (os.connectedComp != null && !(os.connectedComp.ip != c.ip))
                {
                    return;
                }
                for (var index = 0; index < c.ports.Count; ++index)
                {
                    c.closePort(c.ports[index], "LOCAL_ADMIN");
                }
                if (ResetsPassword)
                {
                    c.setAdminPassword(PortExploits.getRandomPassword());
                }
                c.adminIP = c.ip;
                if (c.firewall == null)
                {
                    return;
                }
                c.firewall.resetSolutionProgress();
            };

            if (IsSuper)
            {
                action();
            }
            else
            {
                os.delayer.Post(ActionDelayer.Wait(time), action);
            }
        }
Ejemplo n.º 5
0
        protected override void LoadContent()
        {
            if (!CanLoadContent)
            {
                return;
            }
            PortExploits.populate();
            sman.controllingPlayer = PlayerIndex.One;
            if (Settings.isConventionDemo)
            {
                setWindowPosition(new Vector2(200f, 200f));
            }
            LoadGraphicsContent();
            LoadRegenSafeContent();
            var content = Content;

            GuiData.font        = content.Load <SpriteFont>("Font23");
            GuiData.titlefont   = content.Load <SpriteFont>("Kremlin");
            GuiData.smallfont   = Content.Load <SpriteFont>("Font12");
            GuiData.UISmallfont = GuiData.smallfont;
            GuiData.tinyfont    = Content.Load <SpriteFont>("Font10");
            GuiData.UITinyfont  = GuiData.tinyfont;
            GuiData.detailfont  = Content.Load <SpriteFont>("Font7");
            GuiData.spriteBatch = sman.SpriteBatch;
            GuiData.font        = content.Load <SpriteFont>("Font23");
            GuiData.titlefont   = content.Load <SpriteFont>("Kremlin");
            GuiData.smallfont   = Content.Load <SpriteFont>("Font12");
            GuiData.UISmallfont = GuiData.smallfont;
            GuiData.tinyfont    = Content.Load <SpriteFont>("Font10");
            GuiData.UITinyfont  = GuiData.tinyfont;
            GuiData.detailfont  = Content.Load <SpriteFont>("Font7");
            GuiData.init(Window);
            GuiData.InitFontOptions(Content);
            VehicleInfo.init();
            WorldLocationLoader.init();
            ThemeManager.init(content);
            MissionGenerationParser.init();
            MissionGenerator.init(content);
            UsernameGenerator.init();
            MusicManager.init(content);
            SFX.init(content);
            OldSystemSaveFileManifest.Load();
            SaveFileManager.Init();
            HasLoadedContent = true;
            LoadInitialScreens();
        }
Ejemplo n.º 6
0
 public Computer(string compName, string compIP, Vector2 compLocation, int seclevel, byte compType, OS opSystem)
 {
     name          = compName;
     ip            = compIP;
     location      = compLocation;
     type          = compType;
     files         = generateRandomFileSystem();
     idName        = compName.Replace(" ", "_");
     os            = opSystem;
     traceTime     = -1f;
     securityLevel = seclevel;
     adminIP       = NetworkMap.generateRandomIP();
     users         = new List <UserDetail>();
     adminPass     = PortExploits.getRandomPassword();
     users.Add(new UserDetail("admin", adminPass, 1));
     ports     = new List <int>(seclevel);
     portsOpen = new List <byte>(seclevel);
     openPortsForSecurityLevel(seclevel);
     links   = new List <int>();
     daemons = new List <Daemon>();
 }
Ejemplo n.º 7
0
        protected override void LoadContent()
        {
            if (!this.CanLoadContent)
            {
                return;
            }
            PortExploits.populate();
            this.sman.controllingPlayer = PlayerIndex.One;
            if (Settings.isConventionDemo)
            {
                this.setWindowPosition(new Vector2(200f, 200f));
            }
            this.LoadGraphicsContent();
            this.LoadRegenSafeContent();
            ContentManager content = this.Content;

            GuiData.font        = content.Load <SpriteFont>("Font23");
            GuiData.titlefont   = content.Load <SpriteFont>("Kremlin");
            GuiData.smallfont   = this.Content.Load <SpriteFont>("Font12");
            GuiData.UISmallfont = GuiData.smallfont;
            GuiData.tinyfont    = this.Content.Load <SpriteFont>("Font10");
            GuiData.UITinyfont  = this.Content.Load <SpriteFont>("Font10");
            GuiData.detailfont  = this.Content.Load <SpriteFont>("Font7");
            GuiData.spriteBatch = this.sman.SpriteBatch;
            GuiData.InitFontOptions(this.Content);
            GuiData.init(this.Window);
            DLC1SessionUpgrader.CheckForDLCFiles();
            VehicleInfo.init();
            WorldLocationLoader.init();
            ThemeManager.init(content);
            MissionGenerationParser.init();
            MissionGenerator.init(content);
            UsernameGenerator.init();
            MusicManager.init(content);
            SFX.init(content);
            OldSystemSaveFileManifest.Load();
            try
            {
                SaveFileManager.Init(true);
            }
            catch (UnauthorizedAccessException ex)
            {
                MainMenu.AccumErrors += " ---- WARNING ---\nHacknet cannot access the Save File Folder (Path Below) to read/write save files.\nNO PROGRESS WILL BE SAVED.\n";
                MainMenu.AccumErrors += "Check folder permissions, run Hacknet.exe as Administrator, and try again.\n";
                MainMenu.AccumErrors += "If Errors Persist, search for \"Hacknet Workaround\" for a steam forums thread with more options.\n";
                MainMenu.AccumErrors  = MainMenu.AccumErrors + ":: Error Details ::\n" + Utils.GenerateReportFromException((Exception)ex);
            }
            if (this.NeedsSettingsLocaleActivation)
            {
                if (!Settings.ForceEnglish)
                {
                    string forActiveLanguage = PlatformAPISettings.GetCodeForActiveLanguage(LocaleActivator.SupportedLanguages);
                    LocaleActivator.ActivateLocale(forActiveLanguage, this.Content);
                    Settings.ActiveLocale = forActiveLanguage;
                }
            }
            else if (SettingsLoader.didLoad && Settings.ActiveLocale != "en-us")
            {
                LocaleActivator.ActivateLocale(Settings.ActiveLocale, this.Content);
            }
            Helpfile.init();
            FileEntry.init(this.Content);
            this.HasLoadedContent = true;
            this.LoadInitialScreens();
            if (!WebRenderer.Enabled)
            {
                return;
            }
            XNAWebRenderer.XNAWR_Initialize("file:///nope.html", WebRenderer.textureUpdated, 512, 512);
            WebRenderer.setSize(512, 512);
        }