gddocs icon indicating copy to clipboard operation
gddocs copied to clipboard

Sorry, you have been blocked You are unable to access boomlings.com

Open gdsonicpython opened this issue 1 year ago • 5 comments

when i try to rate a level using this code

# level rater

import requests
import random
from string import ascii_letters, digits  # so we don't have to type [A-Za-z0-9] by hand
import base64
import hashlib  # sha1() lives there

# this code works only on python 3.6 and above

possible_letters = ascii_letters + digits


def generate_rs(n: int) -> str:
    return ("").join(random.choices(possible_letters, k=n))

def generate_uuid(parts) -> str:
    # apply generate_rs to each number in parts, then join results
    return ("-").join(map(generate_rs, (8, 4, 4, 4, 10)))

def generate_udid(start: int = 100_000, end: int = 100_000_000) -> str:
    return "S15" + str(random.randint(start, end)) + str(random.randint(start, end)) + str(random.randint(start, end)) + str(random.randint(start, end))


def xor_cipher(input_str, key):
    result = ""
    for i in range(len(input_str)):
        byte = ord(input_str[i])  # Convert character to byte (integer)
        xKey = ord(key[i % len(key)])  # Get byte from key, cycling through the key
        result += chr(byte ^ xKey)  # XOR and convert back to character
    return result


def generate_chk(values: [int, str] = [], key: str = "", salt: str = "") -> str:
    values.append(salt)

    string = ("").join(map(str, values))  # assure "str" type and connect values

    hashed = hashlib.sha1(string.encode()).hexdigest()
    xored = xor_cipher(hashed, key)  # we discuss this one in encryption/xor
    final = base64.urlsafe_b64encode(xored.encode()).decode()

    return final

def generate_upload_seed(data: str, chars: int = 50) -> str:
    # GD currently uses 50 characters for level upload seed
    if len(data) < chars:
        return data  # not enough data to generate
    step = len(data) // chars
    return data[::step][:chars]

def generate_gjp2(password: str = "", salt: str = "mI29fmAnxgTs") -> str:
    password += salt
    hash = hashlib.sha1(password.encode()).hexdigest()

    return hash

udid = generate_udid()
uuid = generate_uuid((8,4,4,4,10))

chk = generate_chk(values=[15254724, "levelID", 6, "stars", generate_rs(10), "rs", 21294646, "accountID", udid, "UDID", uuid, "UUID"], key="58281", salt="ysg6pUrtjn0J")

data = {
    "secret": "Wmfd2893gb7",
    "levelID": 15254724,
    "accountID": 21294646,
    "chk":chk,
    "rs":generate_rs(10),
    "stars": 6,
    "gjp2":generate_gjp2("insert password here"),
    "UDID":udid,
    "UUID":uuid,
}

req = requests.post('http://boomlings.com/database/rateGJStars211.php', data=data)
print(req.text)

but it gives the following html as a request output:

<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>
<title>Attention Required! | Cloudflare</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/cf.errors.css" />
<!--[if lt IE 9]><link rel="stylesheet" id='cf_styles-ie-css' href="/cdn-cgi/styles/cf.errors.ie.css" /><![endif]-->
<style>body{margin:0;padding:0}</style>


<!--[if gte IE 10]><!-->
<script>
  if (!navigator.cookieEnabled) {
    window.addEventListener('DOMContentLoaded', function () {
      var cookieEl = document.getElementById('cookie-alert');
      cookieEl.style.display = 'block';
    })
  }
</script>
<!--<![endif]-->


</head>
<body>
  <div id="cf-wrapper">
    <div class="cf-alert cf-alert-error cf-cookie-error" id="cookie-alert" data-translate="enable_cookies">Please enable cookies.</div>
    <div id="cf-error-details" class="cf-error-details-wrapper">
      <div class="cf-wrapper cf-header cf-error-overview">
        <h1 data-translate="block_headline">Sorry, you have been blocked</h1>
        <h2 class="cf-subheadline"><span data-translate="unable_to_access">You are unable to access</span> boomlings.com</h2>
      </div><!-- /.header -->

      <div class="cf-section cf-highlight">
        <div class="cf-wrapper">
          <div class="cf-screenshot-container cf-screenshot-full">

              <span class="cf-no-screenshot error"></span>

          </div>
        </div>
      </div><!-- /.captcha-container -->

      <div class="cf-section cf-wrapper">
        <div class="cf-columns two">
          <div class="cf-column">
            <h2 data-translate="blocked_why_headline">Why have I been blocked?</h2>

            <p data-translate="blocked_why_detail">This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.</p>
          </div>

          <div class="cf-column">
            <h2 data-translate="blocked_resolve_headline">What can I do to resolve this?</h2>

            <p data-translate="blocked_resolve_detail">You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.</p>
          </div>
        </div>
      </div><!-- /.section -->

      <div class="cf-error-footer cf-wrapper w-240 lg:w-full py-10 sm:py-4 sm:px-8 mx-auto text-center sm:text-left border-solid border-0 border-t border-gray-300">
  <p class="text-13">
    <span class="cf-footer-item sm:block sm:mb-1">Cloudflare Ray ID: <strong class="font-semibold">8deca19a2afbe7de</strong></span>
    <span class="cf-footer-separator sm:hidden">&bull;</span>
    <span id="cf-footer-item-ip" class="cf-footer-item hidden sm:block sm:mb-1">
      Your IP:
      <button type="button" id="cf-footer-ip-reveal" class="cf-footer-ip-reveal-btn">Click to reveal</button>
      <span class="hidden" id="cf-footer-ip">101.165.***.***</span>
      <span class="cf-footer-separator sm:hidden">&bull;</span>
    </span>
    <span class="cf-footer-item sm:block sm:mb-1"><span>Performance &amp; security by</span> <a rel="noopener noreferrer" href="https://www.cloudflare.com/5xx-error-landing" id="brand_link" target="_blank">Cloudflare</a></span>

  </p>
  <script>(function(){function d(){var b=a.getElementById("cf-footer-item-ip"),c=a.getElementById("cf-footer-ip-reveal");b&&"classList"in b&&(b.classList.remove("hidden"),c.addEventListener("click",function(){c.classList.add("hidden");a.getElementById("cf-footer-ip").classList.remove("hidden")}))}var a=document;document.addEventListener&&a.addEventListener("DOMContentLoaded",d)})();</script>
</div><!-- /.error-footer -->


    </div><!-- /#cf-error-details -->
  </div><!-- /#cf-wrapper -->

  <script>
  window._cf_translation = {};


</script>

</body>
</html>

its just your standard cloudflare "your ip is blocked from using this"

gdsonicpython avatar Nov 07 '24 10:11 gdsonicpython

try requests.post('http://boomlings.com/database/rateGJStars211.php', data=data, headers={"User-Agent": ""}) instead of requests.post('http://boomlings.com/database/rateGJStars211.php', data=data)

xBZZZZ avatar Nov 07 '24 11:11 xBZZZZ

I tried it but it still gives the same error

gdsonicpython avatar Nov 08 '24 12:11 gdsonicpython

try requests.post('http://www.boomlings.com/database/rateGJStars211.php', data=data, headers={"User-Agent": ""}) (added www.)

xBZZZZ avatar Nov 08 '24 13:11 xBZZZZ

You forgot the www It's easy to forgot, so that's why in my project I created a ROOT_URL constants thatsm http://www.boomlings.com/ so I can't forget to put the www Example:

import requests
ROOT_URL = "http://boomlings.com/
req = requests.post(ROOT_URL + "database/getGJDailyLevel, data=...)

Geming400 avatar Nov 09 '24 18:11 Geming400

It is most important that you use www. at the start of your provided boomlings.com link, and make a headers dictionary with User-Agent set to a blank string.

import requests

headers = {
    "User-Agent": ""
}

req = requests.post("http://www.boomlings link here.com/", data=data, headers=headers)

ReallyNewb avatar Dec 05 '24 04:12 ReallyNewb