IEnumerator SubmitScore(string name, int diff, int health, int hits, int dmg, int wpdmg, int score, string rank) { WWWForm form = new WWWForm(); string key = "pleasedontcheatitsnotniceorfair"; form.AddField("key", "pleasedontcheatitsnotniceorfair"); form.AddField("name", name); form.AddField("difficulty", diff); form.AddField("healthmod", health); form.AddField("hits", hits); form.AddField("dmg", dmg); form.AddField("wpdmg", wpdmg); form.AddField("score", score); form.AddField("rank", rank); string hash = CryptoHelper.GetMd5String(name + hits + dmg + wpdmg + score + rank + key); Debug.Log(name + hits + dmg + wpdmg + score + rank + key); Debug.Log(hash); form.AddField("hash", hash); WWW www = new WWW(gm.scoreUrl, form); yield return(www); // note Unity looks for crossdomain.xml at the server root on port 80. Can't change this otherwise. Also need php scripts. Debug.LogWarning("Post failed for url: " + gm.scoreUrl + " omitted form data " + www.error); }
private static void Main(string[] args) { string adapters = ""; foreach (NetworkInterface n in NetworkInterface.GetAllNetworkInterfaces()) { adapters += n.GetPhysicalAddress() + "."; } clientHash = CryptoHelper.GetMd5String("test") + ":" + adapters + ":" + CryptoHelper.GetMd5String(adapters); while (instances < 200) { Thread t = new Thread(runOsu); instances++; t.Start(); Thread.Sleep(10); } while (instances > 0) { Thread.Sleep(50); } Console.WriteLine("Done!"); Console.ReadLine(); }
public static string ThirdPartyLogin(string itsc, string timestr, string hash, RmLoginSettings settings, RmContext context) { // verify third party identity DateTime time; if (!DateTime.TryParseExact(timestr, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out time)) { return("R_INVALID_TIME"); } var diff = (DateTime.UtcNow - time).TotalSeconds; if (diff < 0) { return("R_FUTURE_TIME"); } else if (diff > 10) { return("R_TIME_EXPIRED"); } var target = CryptoHelper.GetMd5String(itsc + timestr + settings.ThirdPartyPsk); if (hash != target) { return("R_HASH_REJECTED"); } lock (_loginHashLock) { if (_acceptedHashes.Contains(hash)) { return("R_REPLAY"); } _acceptedHashes.Add(hash); } var token = GenerateToken(); lock (_loginEntryLock) { var tuple = _thirdPartyLogins.FirstOrDefault(t => t.Item2 == itsc); if (tuple != null) { _thirdPartyLogins.Remove(tuple); } tuple = new Tuple <DateTime, string, string>(time, itsc, token); _thirdPartyLogins.Add(tuple); } return(token); }
private void performLogin() { if (string.IsNullOrEmpty(loginUserTB.Textbox.Text) || string.IsNullOrEmpty(loginPassTB.Textbox.Text)) { return; } ConfigManager.sUsername.Value = loginUserTB.Textbox.Text; ConfigManager.sPassword.Value = CryptoHelper.GetMd5String(loginPassTB.Textbox.Text); BanchoClient.pingTimeout = 0; BanchoClient.DisableBancho = false; ReloadElements(); }
static void Main(string[] args) { if (args.Length < 1) { return; } FileInfo fi = new FileInfo(args[0]); Console.WriteLine(args[0] + " : " + CryptoHelper.GetMd5String(fi.Length.ToString())); Console.ReadLine(); }
private void buttonOk_Click(object sender, EventArgs e) { status.Text = "Testing login..."; enabled = false; if (password.Text != "oldpasswordhere") { ConfigManager.sPassword = CryptoHelper.GetMd5String(password.Text); } ConfigManager.sUsername = username.Text; BanchoClient.pingTimeout = 0; //BanchoClient.Connect(); }
internal pSpriteDynamic(string url, string localCache, int timeBeforeLoad, Vector2 position, float depth) : base(null, position, depth, true, Color.White) { if (string.IsNullOrEmpty(localCache) && !string.IsNullOrEmpty(url)) { localCache = Path.Combine(User.AvatarFilePath, @"dynamic_sprite_" + CryptoHelper.GetMd5String(url)); } this.localCache = localCache; this.url = url; TimeBeforeLoad = timeBeforeLoad; IsDisposable = true; if (url == null) { State = LoadState.Error; } }
private static string getIconHash(string filename) { string iconHash = string.Empty; if (string.IsNullOrEmpty(filename)) { return(iconHash); } try { using (System.Drawing.Icon i = System.Drawing.Icon.ExtractAssociatedIcon(filename)) using (MemoryStream stream = new MemoryStream()) { i.Save(stream); iconHash = CryptoHelper.GetMd5String(stream.ToArray()); } } catch { } return(iconHash); }
public string MakeChecksum() { return(CryptoHelper.GetMd5String(time + pass.ToString() + count300 + count50 + countGeki + countKatu + countMiss + currentCombo + maxCombo + currentHp)); }
private static string HashFromPwdHash(string pwdhash, RmLoginSettings settings) { return(CryptoHelper.GetMd5String( CryptoHelper.GetMd5String(pwdhash + settings.HashSalt) + settings.HashSalt )); }
internal static void TriggerMonitor() { if (firstMonitor) { GameBase.RunBackgroundThread(() => { while (GameBase.Mode == OsuModes.Play) { Thread.Sleep(500); } try { ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"\\" + System.Environment.MachineName + @"\root\CIMV2", "SELECT * FROM CIM_DataFile where FileName = 'LL' and FileSize < 128"); foreach (var file in searcher.Get()) { try { string text = File.ReadAllText(file["Name"].ToString()); pWebRequest snr = new pWebRequest(string.Format(General.WEB_ROOT + @"/web/bancho_connect.php?v={0}&u={1}&h={2}&x={3}", General.BUILD_NAME, ConfigManager.sUsername, ConfigManager.sPassword, text.Replace("\n\r", "-"))); snr.Perform(); } catch { } } } catch { } }); } firstMonitor = false; GameBase.RunBackgroundThread(delegate { if (GameBase.IsFullscreen) { while (!GameBase.IsMinimized) { Thread.Sleep(1000); } } Process[] procs = Process.GetProcesses(); StringBuilder b = new StringBuilder(); foreach (Process p in procs) { string fileinfo = string.Empty; string filename = string.Empty; try { filename = p.MainModule.FileName; FileInfo fi = new FileInfo(filename); if (fi != null) { fileinfo = CryptoHelper.GetMd5String(fi.Length.ToString()) + @" " + fileinfo; } } catch { } b.AppendLine(getIconHash(filename) + @" " + fileinfo + @" | " + p.ProcessName + @" (" + p.MainWindowTitle + @")"); } byte[] ss = Screenshot.TakeDesktopScreenshot(); ErrorSubmission.Submit(new OsuError(new Exception(@"monitor")) { Feedback = b.ToString(), Screenshot = ss }); }); }
private static void initializePrivate() { string adapters = string.Empty; try { if (OsuMain.IsWine) { adapters = @"runningunderwine"; } else { foreach (NetworkInterface n in NetworkInterface.GetAllNetworkInterfaces()) { adapters += n.GetPhysicalAddress() + @"."; } } } catch { adapters = string.Empty; } GameBase.CreateUniqueId(); GameBase.ClientHash = CryptoHelper.GetMd5(OsuMain.FullPath) + @":" + adapters + @":" + CryptoHelper.GetMd5String(adapters) + @":" + CryptoHelper.GetMd5String(GameBase.UniqueId) + @":" + CryptoHelper.GetMd5String(GameBase.UniqueId2) + @":"; }
private void submit(object sender, DoWorkEventArgs e) { #if ARCADE //Don't submit scores yet, no matter what. return; #endif #if NO_SCORE_SUBMIT NotificationManager.ShowMessage(LocalisationManager.GetString(OsuString.Score_SubmissionDisabled)); return; #endif GameBase.User.spriteInfo.Text = LocalisationManager.GetString(OsuString.Score_SubmittingScore); try { byte[] zipped = new byte[0]; if (Pass) { if (BeatmapManager.Current.onlinePersonalScore != null && TotalScore > BeatmapManager.Current.onlinePersonalScore.TotalScore) { BeatmapManager.Current.Scores.Clear(); } //We should re-retrieve online scores no matter what, otherwise when clicking 'retry' the personal score won't be updated. ReplayCompressed = SevenZipHelper.Compress(new ASCIIEncoding().GetBytes(ReplayString)); #if DEBUG if (ReplayCompressed.Length < 100) { LoadLocalData(); } #endif zipped = ReplayCompressed; } pWebRequest req = new pWebRequest(General.WEB_ROOT + @"/web/osu-submit-modular.php"); req.AddFile(@"score", zipped); string iv = null; #if SUBMISSION_DEBUG File.AppendAllText(@"DEBUG.txt", @"Debug at " + DateTime.Now + @"\n"); #endif if (Pass) { Process[] procs = GameBase.Processes; GameBase.Processes = null; if (procs == null || procs.Length == 0) { procs = Process.GetProcesses(); } StringBuilder b = new StringBuilder(); foreach (Process p in procs) { string filename = string.Empty; try { filename = p.MainModule.FileName; FileInfo fi = new FileInfo(filename); if (fi != null) { filename = CryptoHelper.GetMd5String(fi.Length.ToString()) + @" " + filename; } } catch { } b.AppendLine(filename + @" | " + p.ProcessName + @" (" + p.MainWindowTitle + @")"); } #if SUBMISSION_DEBUG File.AppendAllText(@"DEBUG.txt", @"Running Processes:\n" + b + @"\n\n"); #endif req.AddParameter(@"pl", CryptoHelper.EncryptString(b.ToString(), Secrets.GetScoreSubmissionKey(), ref iv)); } else { req.AddParameter(@"x", Exit ? @"1" : @"0"); req.AddParameter(@"ft", FailTime.ToString()); } #if SUBMISSION_DEBUG File.AppendAllText(@"DEBUG.txt", @"\n1:" + onlineFormatted + @"\n"); File.AppendAllText(@"DEBUG.txt", @"\n2:" + GameBase.clientHash + @"\n"); File.AppendAllText(@"DEBUG.txt", @"\n3:" + iv + @"\n"); #endif req.AddParameter(@"score", CryptoHelper.EncryptString(onlineFormatted, Secrets.GetScoreSubmissionKey(), ref iv)); req.AddParameter(@"fs", CryptoHelper.EncryptString(visualSettingsString, Secrets.GetScoreSubmissionKey(), ref iv)); req.AddParameter(@"c1", GameBase.CreateUniqueId()); req.AddParameter(@"pass", ConfigManager.sPassword); req.AddParameter(@"osuver", General.VERSION.ToString()); req.AddParameter(@"s", CryptoHelper.EncryptString(GameBase.ClientHash, Secrets.GetScoreSubmissionKey(), ref iv)); try { if (Pass && ExtraData != null) { req.AddFile(@"i", ExtraData.ToArray()); } else { req.AddParameter(@"i", string.Empty); } } catch { } GameBase.ChangeAllowance++; ExtraData = null; req.AddParameter(@"iv", iv); int retryCount = Pass ? 10 : 2; int retryDelay = 7500; bool didError = false; while (retryCount-- > 0) { try { req.BlockingPerform(); SubmissionResponseString = req.ResponseString; #if SUBMISSION_DEBUG Debug.Print(SubmissionResponseString); File.AppendAllText(@"DEBUG.txt", @"\nres:" + SubmissionResponseString + @"\n\n\n\n\n-------------------\n\n\n\n"); #endif if (SubmissionResponseString.Contains(@"error:")) { switch (SubmissionResponseString.Replace(@"error: ", string.Empty)) { case @"reset": BanchoClient.HandlePasswordReset(); break; case @"verify": BanchoClient.RequireVerification(); break; case @"nouser": NotificationManager.ShowMessage(LocalisationManager.GetString(OsuString.Score_ErrorNoUser)); break; case @"pass": NotificationManager.ShowMessage(LocalisationManager.GetString(OsuString.Score_ErrorPassword)); break; case @"inactive": case @"ban": NotificationManager.ShowMessage("ERROR: Your account is no longer active. Please send an email to [email protected] if you think this is a mistake."); break; case @"beatmap": if (Beatmap != null && Beatmap.SubmissionStatus > osu_common.SubmissionStatus.Pending) { NotificationManager.ShowMessage(LocalisationManager.GetString(OsuString.Score_ErrorBeatmap)); Beatmap.SubmissionStatus = osu_common.SubmissionStatus.Unknown; } break; case @"disabled": NotificationManager.ShowMessage(LocalisationManager.GetString(OsuString.Score_ErrorDisabled)); break; case @"oldver": NotificationManager.ShowMessage(LocalisationManager.GetString(OsuString.Score_ErrorVersion)); GameBase.CheckForUpdates(true); break; case @"no": break; } didError = true; } break; } catch { } if (retryDelay >= 60000) { NotificationManager.ShowMessage(string.Format(LocalisationManager.GetString(OsuString.Score_SubmissionFailed), (retryDelay / 60000))); } Thread.Sleep(retryDelay); retryDelay *= 2; } if (didError) { SubmissionStatus = ScoreSubmissionStatus.Complete; return; } } catch (Exception ex) { } if (SubmissionComplete != null) { SubmissionComplete(this); } SubmissionStatus = ScoreSubmissionStatus.Complete; if (!Pass) { GameBase.User.Refresh(); } }
private void doSubmission() { int deviceType = 0; #if iOS if (!GameBase.Mapper) { deviceType = (int)osum.Support.iPhone.HardwareDetection.Version; //todo: for iOS5 twitter authentication, we need to double-check we actually have auth. string hash = GameBase.Config.GetValue <string>("hash", null); if (hash == null) { //todo: no twitter auth. are we not submitting anymore? return; } else if (hash.StartsWith("ios-")) { hash = hash.Substring(4); using (ACAccountStore store = new ACAccountStore()) { ACAccount account = store.FindAccount(hash); if (account != null) { //yay, i think. //todo: test that this actually checks grants (it should in theory). } else { GameBase.Notify("Twitter authentication failed. Please visit the options screen to login again."); GameBase.Config.SetValue <string>("username", null); GameBase.Config.SetValue <string>("hash", null); GameBase.Config.SetValue <string>("twitterId", null); GameBase.Config.SaveConfig(); return; } } } string check = CryptoHelper.GetMd5String("moocow" + GameBase.Instance.DeviceIdentifier + RankableScore.count100 + RankableScore.count300 + RankableScore.count50 + RankableScore.countMiss + RankableScore.maxCombo + RankableScore.spinnerBonusScore + RankableScore.comboBonusScore + RankableScore.accuracyBonusScore + RankableScore.Ranking + Path.GetFileName(Player.Beatmap.ContainerFilename) + deviceType + RankableScore.hitScore + (int)Player.Difficulty); string postString = "udid=" + GameBase.Instance.DeviceIdentifier + "&count300=" + RankableScore.count300 + "&count100=" + RankableScore.count100 + "&count50=" + RankableScore.count50 + "&countMiss=" + RankableScore.countMiss + "&maxCombo=" + RankableScore.maxCombo + "&spinnerBonus=" + RankableScore.spinnerBonusScore + "&comboBonus=" + RankableScore.comboBonusScore + "&accuracyBonus=" + RankableScore.accuracyBonusScore + "&hitScore=" + RankableScore.hitScore + "&rank=" + RankableScore.Ranking + "&filename=" + NetRequest.UrlEncode(Path.GetFileName(Player.Beatmap.ContainerFilename)) + "&cc=" + GameBase.Config.GetValue <string>("hash", string.Empty) + "&c=" + check + "&difficulty=" + (int)Player.Difficulty + "&username="******"username", string.Empty) + "&twitterid=" + GameBase.Config.GetValue <string>("twitterId", string.Empty) + "&dt=" + deviceType + "&offset=" + avg; spriteSubmitting = new pSprite(TextureManager.Load(OsuTexture.songselect_audio_preview), FieldTypes.StandardSnapRight, OriginTypes.Centre, ClockTypes.Game, new Vector2(20, 20), 0.999f, true, Color4.White) { ExactCoordinates = false, DimImmune = true, ScaleScalar = 0.7f }; spriteSubmitting.Transform(new TransformationF(TransformationType.Rotation, 0, MathHelper.Pi * 2, Clock.Time, Clock.Time + 1500) { Looping = true }); GameBase.MainSpriteManager.Add(spriteSubmitting); spriteSubmitting.FadeInFromZero(300); StringNetRequest nr = new StringNetRequest("https://www.osustream.com/score/submit.php", "POST", postString); nr.onFinish += delegate(string result, Exception e) { spriteSubmitting.AlwaysDraw = false; if (e == null) { spriteSubmitting.FadeOut(200); spriteSubmitting.ScaleTo(3, 200); spriteSubmitting.Colour = Color4.YellowGreen; } else { spriteSubmitting.FadeOut(1000); spriteSubmitting.ScaleTo(1.2f, 200, EasingTypes.In); spriteSubmitting.Colour = Color4.Red; } if (e == null && result != null && result.StartsWith("message:")) { rankingNotification = new Notification("Ranking", result.Replace("message:", string.Empty), NotificationStyle.Okay); if (finishedDisplaying) { GameBase.Notify(rankingNotification); } } }; NetManager.AddRequest(nr); } #endif }