Skip to content

Commit

Permalink
Bugs and new currencies, new random
Browse files Browse the repository at this point in the history
Bitvest LastUser Seed fixed, Increased the length of client seeds
attempted a new CF bypass and failed. Damn
Created a new Random class that is cryptographically secure, probably.
Added a nonce skipped check for nitrodice
Fixed Nitrodice roll verifier
Nitrodice betid fix
Added trx to pd
Added trx to stake
Wolf.bet bet rounding and using chance from the site instead of recalculating it.
  • Loading branch information
Seuntjie900 committed Jan 13, 2020
1 parent b0a9995 commit 5115436
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 27 deletions.
Binary file modified .vs/DiceBot/v15/.suo
Binary file not shown.
28 changes: 15 additions & 13 deletions DiceBot/Bitvest.cs
Expand Up @@ -53,7 +53,7 @@ string RandomSeed()
{
string s = "";
string chars = "0123456789abcdef";
while (s.Length<20)
while (s.Length<60)
{
s += chars[R.Next(0, chars.Length)];
}
Expand Down Expand Up @@ -381,6 +381,7 @@ public override void Login(string Username, string Password, string otp)
Parent.updateLosses(losses);
//Parent.updateDeposit(tmpblogin.account.address);
lastupdate = DateTime.Now;
seed = tmpblogin.last_user_seed;
ispd = true;
pw = Password;
new Thread(new ThreadStart(GetBalanceThread)).Start();
Expand Down Expand Up @@ -550,20 +551,20 @@ public override void SetClientSeed(string Seed)
public override bool ReadyToBet()
{
decimal weight = 1;
switch (Currency.ToLower())
if (Currency.ToLower() == "bitcoins")
{
case "bitcoins":weight = decimal.Parse(Weights.BTC, System.Globalization.NumberFormatInfo.InvariantInfo);break;
case "tokens": weight = decimal.Parse(Weights.TOK, System.Globalization.NumberFormatInfo.InvariantInfo); break;
case "litecoins": weight = decimal.Parse(Weights.LTC, System.Globalization.NumberFormatInfo.InvariantInfo); break;
case "ethers": weight = decimal.Parse(Weights.ETH, System.Globalization.NumberFormatInfo.InvariantInfo); break;
case "dogecoins": weight = decimal.Parse(Weights.DOGE, System.Globalization.NumberFormatInfo.InvariantInfo); break;
case "bcash": weight = decimal.Parse(Weights.BCH, System.Globalization.NumberFormatInfo.InvariantInfo); break;

default: weight = decimal.Parse(Weights.BTC, System.Globalization.NumberFormatInfo.InvariantInfo); break;
switch (Currency.ToLower())
{
case "bitcoins": weight = decimal.Parse(Weights.BTC, System.Globalization.NumberFormatInfo.InvariantInfo); break;
case "tokens": weight = decimal.Parse(Weights.TOK, System.Globalization.NumberFormatInfo.InvariantInfo); break;
case "litecoins": weight = decimal.Parse(Weights.LTC, System.Globalization.NumberFormatInfo.InvariantInfo); break;
case "ethers": weight = decimal.Parse(Weights.ETH, System.Globalization.NumberFormatInfo.InvariantInfo); break;
case "dogecoins": weight = decimal.Parse(Weights.DOGE, System.Globalization.NumberFormatInfo.InvariantInfo); break;
case "bcash": weight = decimal.Parse(Weights.BCH, System.Globalization.NumberFormatInfo.InvariantInfo); break;

default: weight = decimal.Parse(Weights.BTC, System.Globalization.NumberFormatInfo.InvariantInfo); break;
}
}



for (int i = Limits.Length-1; i>=0;i--)
{
if (i == Limits.Length-1 && (amount*weight)>=(decimal)Limits[i]*0.00000001m)
Expand Down Expand Up @@ -762,6 +763,7 @@ public class bitvestLoginBase
public bitvesttip tip { get; set; }
public bitvestCurWeight currency_weight { get; set; }
public double[] rate_limits { get; set; }
public string last_user_seed { get; set; }
}
public class bitvestCurWeight
{
Expand Down
39 changes: 36 additions & 3 deletions DiceBot/Cloudflare.cs
Expand Up @@ -19,31 +19,64 @@ public static bool doCFThing(string Response, HttpClient Client, HttpClientHandl

string s1 = Response;//new StreamReader(Response.GetResponseStream()).ReadToEnd();
string Script = "";
string jschl_tk = s1.Substring(s1.IndexOf("cf_chl_jschl_tk__=")+ "cf_chl_jschl_tk__=".Length);
jschl_tk = jschl_tk.Substring(0, jschl_tk.IndexOf("\""));
string r = s1.Substring(s1.IndexOf("name=\"r\" value=\"")+ "name=\"r\" value=\"".Length);
r = r.Substring(0, r.IndexOf("\""));
string jschl_vc = s1.Substring(s1.IndexOf("jschl_vc"));

jschl_vc = jschl_vc.Substring(jschl_vc.IndexOf("value=\"") + "value=\"".Length);
jschl_vc = jschl_vc.Substring(0, jschl_vc.IndexOf("\""));
string pass = s1.Substring(s1.IndexOf("\"pass\""));
pass = pass.Substring(pass.IndexOf("value=\"") + "value=\"".Length);
pass = pass.Substring(0, pass.IndexOf("\""));

//do the CF bypass thing and get the headers
Script = s1.Substring(s1.IndexOf("var s,t,o,p,b,r,e,a,k,i,n,g,f,") + "var s,t,o,p,b,r,e,a,k,i,n,g,f, ".Length);
string Script1 = "var " + Script.Substring(0, Script.IndexOf(";") + 1);
Script = s1.Substring(s1.IndexOf("var s,t,o,p,b,r,e,a,k,i,n,g,f,"));
string Script1 = Script.Substring(0, Script.IndexOf(";") + 1);
Script = Script.Substring("var s,t,o,p,b,r,e,a,k,i,n,g,f, ".Length);
string varName = Script.Substring(0, Script.IndexOf("="));
string varNamep2 = Script.Substring(Script.IndexOf("\"") + 1);
string Script3 = Script.Substring(Script.IndexOf(";") + 1);
Script3 = Script3.Substring(0, Script3.IndexOf("t = document"));
Script1 += Script3;
string kkkk = Script.Substring(Script.IndexOf("k = '")+ "k = '".Length);
kkkk = kkkk.Substring(0, kkkk.IndexOf("';"));
string kvalue = s1.Substring(s1.IndexOf($"id=\"{kkkk}\">")+ $"id=\"{kkkk}\">".Length);
kvalue = "var innr = " + kvalue.Substring(0, kvalue.IndexOf("<"))+";";
Script1 += kvalue;
varName += "." + varNamep2.Substring(0, varNamep2.IndexOf("\""));
Script1 += Script.Substring(Script.IndexOf(varName));
Script1 = Script1.Substring(0, Script1.IndexOf("f.submit()"));
Script1 = Script1.Replace("t.length", URI.Length + "");
Script1 = Script1.Replace("a.value", "var answer");
if (Script1.Contains("f.action += location.hash;")|| Script1.Contains("f.action+=location.hash;"))
Script1 = Script1.Replace("f.action += location.hash;", "").Replace("f.action+=location.hash;", "");
Script1 = Script1.Replace("(function(p){return eval((true+\"\")[0]+\".ch\"+(false+\"\")[1]+(true+\"\")[1]+Function(\"return escape\")()((\"\")[\"italics\"]())[2]+\"o\"+(undefined+\"\")[2]+(true+\"\")[3]+\"A\"+(true+\"\")[0]+\"(\"+p+\")\")}",$"(function(p){{ return eval(\"{URI}\".charCodeAt(p)) }}");
Script1 = Script1.Replace("function(p){var p = eval(eval(e(\"ZG9jdW1l\")+(undefined+\"\")[1]+(true+\"\")[0]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+g(103)+(true+\"\")[3]+(true+\"\")[0]+\"Element\"+g(66)+(NaN+[Infinity])[10]+\"Id(\"+g(107)+\").\"+e(\"aW5uZXJIVE1M\"))); return +(p)}();",
"function(p){var p = eval(eval(innr));return +(p)}();");


JSC.Run(Script1);
string answer = JSC.GetParameter("answer").ToString();

try
{
HttpResponseMessage Resp = Client.GetAsync("cdn-cgi/l/chk_jschl?jschl_vc=" + jschl_vc + "&pass=" + pass.Replace("+", "%2B").Replace("-", "%2D") + "&jschl_answer=" + answer).Result;
List<KeyValuePair<string, string>> pairs = new List<KeyValuePair<string, string>>();
pairs.Add(new KeyValuePair<string, string>("r", r));
pairs.Add(new KeyValuePair<string, string>("jschl_vc", jschl_vc));
pairs.Add(new KeyValuePair<string, string>("pass",pass ));
pairs.Add(new KeyValuePair<string, string>("jschl_answer",answer ));
FormUrlEncodedContent Content = new FormUrlEncodedContent(pairs);
string url = $"https://{URI}/?__cf_chl_jschl_tk__={jschl_tk}";
Content.Headers.Add("Origin", "https://wolf.bet");
//Content.Headers.Add("Referer", "https://wolf.bet/");
Content.Headers.Add("sec-fetch-mode", "navigate");
Content.Headers.Add("sec-fetch-site", "same-origin");
//Content.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9");
Content.Headers.Remove("content-type");
Content.Headers.Add("content-type", "application/x-www-form-urlencoded");
HttpResponseMessage Resp = Client.PostAsync(url, Content).Result;

bool Found = false;

Expand Down
43 changes: 43 additions & 0 deletions DiceBot/DiceSite.cs
Expand Up @@ -333,4 +333,47 @@ public class RequireCaptchaEventArgs:EventArgs
public string ResponseValue { get; set; }
public string Domain { get; set; }
}

public class Random
{
RandomNumberGenerator r = RandomNumberGenerator.Create();
const string chars = "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm";
public virtual uint Next(uint max)
{
byte[] bytes = new byte[4];
r.GetBytes(bytes);
uint result = BitConverter.ToUInt32(bytes, 0);
return (result % max);
}
public virtual uint Next(uint min, uint max)
{
uint result = Next(max-min);
return (min+result);
}
public virtual int Next(int min, int max)
{
return min + Next(max - min);
}
public virtual int Next(int max)
{
byte[] bytes = new byte[4];
r.GetBytes(bytes);
int result = BitConverter.ToInt32(bytes, 0);
return (Math.Abs(result % max));
}
public virtual int Next()
{

return Next(int.MaxValue);
}
public string RandomString(int length)
{
string x = "";
while(x.Length>0)
{
x += chars[Next(0, chars.Length)];
}
return x;
}
}
}
22 changes: 19 additions & 3 deletions DiceBot/NitroDice.cs
Expand Up @@ -207,7 +207,7 @@ protected override void internalPlaceBet(bool High, decimal amount, decimal chan
this.High = High;
new Thread(new ParameterizedThreadStart(placebetthread)).Start(new PlaceBetObj(High, amount, chance, BetGuid));
}

long nonce = -1;
public static new decimal sGetLucky(string server, string client, long nonce)
{
SHA512 betgenerator = SHA512.Create();
Expand Down Expand Up @@ -259,7 +259,13 @@ public static new decimal sGetLucky(string server, string client, long nonce)
string hexres = "";
for (int i =0; i<r.Length;i++)
{
hexres+= r[i]=="0"?"00": r[i];
string tmp = r[i];
if (tmp.Length<2)
{

}

hexres += tmp.Length < 2 ? "0" + tmp : tmp;
}
long Lucky = long.Parse(hexres, System.Globalization.NumberStyles.HexNumber);
decimal result = ((decimal)(Lucky % 1000000)) / 10000m;
Expand Down Expand Up @@ -296,9 +302,19 @@ void placebetthread(object bet)
});
StringContent Content = new StringContent(jsoncontent, Encoding.UTF8, "application/json");
string Response = Client.PostAsync("api/bet", Content).Result.Content.ReadAsStringAsync().Result;

NDGetBet BetResult = json.JsonDeserialize<NDGetBet>(Response);


if (BetResult.info == null)
{
if (nonce == -1)
nonce = BetResult.index;
else if (nonce != BetResult.index - 1)
{
Parent.DumpLog("123 NONCE SKIPPED!!!!!! 12345!!!!", -1);
}
nonce = BetResult.index;
Bet tmp = new Bet
{
Amount = amount,
Expand All @@ -309,7 +325,7 @@ void placebetthread(object bet)
serverhash = lastHash,
Guid = tmp5.Guid,
high = High,
Id = BetResult.n.ToString(),
Id = BetResult.no.ToString(),
nonce = BetResult.index,
Roll = BetResult.n / 10000m,
serverseed = BetResult.sseed,
Expand Down
3 changes: 2 additions & 1 deletion DiceBot/PD.cs
Expand Up @@ -21,7 +21,7 @@ public class PD : DiceSite
protected string RolName = "primediceRoll";
protected string GameName = "CasinoGamePrimedice";
protected string StatGameName = "primedice";
public static string[] sCurrencies = new string[] { "Btc", "Ltc","Eth","Doge","Bch", "XRP" };
public static string[] sCurrencies = new string[] { "Btc", "Ltc","Eth","Doge","Bch", "XRP","TRX" };
GraphQL.Client.GraphQLClient GQLClient;
string accesstoken = "";
DateTime LastSeedReset = new DateTime();
Expand Down Expand Up @@ -52,6 +52,7 @@ public PD(cDiceBot Parent)
SiteURL = "https://primedice.com/?c=Seuntjie";
if (File.Exists("fast") || File.Exists("fast.txt"))
getid = false;

}
string userid = "";

Expand Down
4 changes: 2 additions & 2 deletions DiceBot/Properties/AssemblyInfo.cs
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.4.4.0")]
[assembly: AssemblyFileVersion("3.4.4.0")]
[assembly: AssemblyVersion("3.4.6.0")]
[assembly: AssemblyFileVersion("3.4.6.0")]
2 changes: 1 addition & 1 deletion DiceBot/Stake.cs
Expand Up @@ -13,7 +13,7 @@ namespace DiceBot
class Stake: PD
{

public static new string[] sCurrencies = new string[] { "Btc", "Eth", "Ltc","Doge", "Bch","Xrp" };
public static new string[] sCurrencies = new string[] { "Btc", "Eth", "Ltc","Doge", "Bch","Xrp","Trx" };

public Stake(cDiceBot Parent):base(Parent)/*:base(Parent)*/
{
Expand Down
40 changes: 36 additions & 4 deletions DiceBot/WolfBet.cs
Expand Up @@ -18,7 +18,7 @@ class WolfBet : DiceSite
string accesstoken = "";
public bool ispd = false;
DateTime lastupdate = new DateTime();
HttpClient Client;// = new HttpClient { BaseAddress = new Uri("https://api.primedice.com/api/") };
HttpClient Client;
HttpClientHandler ClientHandlr;
public static string[] cCurrencies = new string[] { "btc", "eth", "ltc", "trx", "bch","doge" };
string URL = "https://wolf.bet";
Expand Down Expand Up @@ -74,9 +74,41 @@ public override void Login(string Username, string Password, string twofa)
Client = new HttpClient(ClientHandlr) { BaseAddress = new Uri(URL+"/api/v1/") };
Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("gzip"));
Client.DefaultRequestHeaders.AcceptEncoding.Add(new System.Net.Http.Headers.StringWithQualityHeaderValue("deflate"));
Client.DefaultRequestHeaders.Add("UserAgent", Parent.UserAgent);
Client.DefaultRequestHeaders.Add("UserAgent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36");
Client.DefaultRequestHeaders.Add("Origin", "https://wolf.bet");
Client.DefaultRequestHeaders.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9");
try
{

HttpResponseMessage resp1 = Client.GetAsync("").Result;
string s1 = "";
if (resp1.IsSuccessStatusCode)
{
s1 = resp1.Content.ReadAsStringAsync().Result;
//Parent.DumpLog("BE login 2.1", 7);
}
else
{
//Parent.DumpLog("BE login 2.2", 7);
if (resp1.StatusCode == HttpStatusCode.ServiceUnavailable)
{
s1 = resp1.Content.ReadAsStringAsync().Result;
//cflevel = 0;
System.Threading.Tasks.Task.Factory.StartNew(() =>
{
System.Windows.Forms.MessageBox.Show($"{Name} has their cloudflare protection on HIGH\n\nThis will cause a slight delay in logging in. Please allow up to a minute.");
});
if (!Cloudflare.doCFThing(s1, Client, ClientHandlr, 0, URL.Replace("https://","")))
{

finishedlogin(false);
return;
}

}
//Parent.DumpLog("BE login 2.3", 7);
}
Client.DefaultRequestHeaders.Add("X-Requested-With", "XMLHttpRequest");
string mfa = twofa==""?"": $",\"code\":\"{twofa}\"";
string LoginString = $"{{\"login\":\"{Username}\",\"password\":\"{Password}\"{mfa}}}";
HttpContent cont = new StringContent(LoginString);
Expand Down Expand Up @@ -265,7 +297,7 @@ private void placebetthread(object obj)
PlaceBetObj tmp5 = obj as PlaceBetObj;
WolfPlaceBet tmp = new WolfPlaceBet
{
amount = tmp5.Amount.ToString(System.Globalization.NumberFormatInfo.InvariantInfo),
amount = tmp5.Amount.ToString("0.00000000",System.Globalization.NumberFormatInfo.InvariantInfo),
currency = Currency,
rule = tmp5.High ? "over" : "under",
multiplier = ((100m - edge) / tmp5.Chance).ToString("0.####",System.Globalization.NumberFormatInfo.InvariantInfo),
Expand All @@ -290,7 +322,7 @@ private void placebetthread(object obj)
Bet tmpRsult = new Bet()
{
Amount = decimal.Parse(result.bet.amount, System.Globalization.NumberFormatInfo.InvariantInfo),
Chance = (100m - edge) / (decimal.Parse(result.bet.multiplier, System.Globalization.NumberFormatInfo.InvariantInfo)),
Chance = decimal.Parse(result.bet.bet_value, System.Globalization.NumberFormatInfo.InvariantInfo),
clientseed = result.bet.user_seed,
date = DateTime.Now,
Currency = Currency,
Expand Down

0 comments on commit 5115436

Please sign in to comment.