NOT : I only have rcon password
I want to retrieve the logs on the csgo server, but I couldn't do it.
I can use c# nodejs and python
I created a project in replit using python and flask and with logaddress_add_http.I added the link of this project to the csgo server and it worked, but I could not figure out how to get the logs by adding the ip of my own computer with the logaddress_add to the csgo server.
Please help me, I couldn't find any sources about this
log on
logaddress_add_http "https://CSGO.synx12.repl.co"
My Code:
from flask import Flask,request
app=Flask(__name__)
#app.route("/",methods=["GET","POST"])
def index():
if(request.method=="GET"):
return "GET"
elif(request.method=="POST"):
data=request.get_data()
print(data)
return f"Data : {data}"
if(__name__=="__main__"):
app.run(host="0.0.0.0",port=8080)
I'm sending a message to the server with rcon
And Result
here logaddress_add_http works fine but I couldn't get logaddress_add to work at all
I want your help for this.
Related
Basically I just booted up an older script that I made 1-2 months ago and which worked perfectly at the time, but now when I try to connect to the ngrok tunnel i get a 404 and a "Tunnel xxxx not found"
I have a non-paying user, which didn't use to be a problem and I cant see anywhere that they changed their terms of service and I can find the tunnel on the dashboard but not connect, any idea what is wrong and if they changed something?
I just booted an old super simple test script which also doesn't work, I can see the tunnel but it returns "Funnel xxxx not found" and server 404:
from flask import Flask
from flask_ngrok import run_with_ngrok
app = Flask(__name__)
run_with_ngrok(app) #starts ngrok when the app is run
#app.route("/")
def home():
return "<h1>Running Flask on Google Colab!</h1>"
app.run()
Context
I'm currently following this tutorial. - Telegram Bot with Python Tutorial #3: Creating Bot and Webhook | Project
FIRST STEP
I have set-up a Flask server using the following python code:
from flask import Flask
from flask import request
from flask import Response
import json
app = Flask(__name__)
#app.route('/', methods=['POST', 'GET'])
def index():
if request.method == 'POST':
print(request)
message = request.json()
with open('telegram_request.json', 'w', encoding='utf-8') as filename:
json.dump(message, filename, ensure_ascii=False, indent=4)
# prevents telegram from spamming
return Response('Ok', status=200)
else:
return """
<h1> Flask Server </h1>
<h2> Up and running </h2>
"""
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=8443)
SECOND STEP
I port forwarded port 8443 in my router to make the server visible to the outside world (tunneling step in tutorial).
The domain name "myprivatedomain.com:8443" now redirects/refers to the flask server that is set-up.
THIRD STEP
I set-up the Telegram-API webhook correctly, getting the following response code from Telegram:
{"ok":true,"result":true,"description":"Webhook was set"}
NOW
Before sending a message in the Telegram chat: there were no errors.
After sending a message in the chat, the following errors popped up:
code 400, message Bad HTTP/0.9 request type
('RANDOM BYTE VALUES like \x00\x03')
code 400, message Bad request syntax
('RANDOM BYTE VALUES like \x00\x03')
code 400, message Bad request version
('RANDOM BYTE VALUES like \x00\x03')
WHAT I WANT
According to the tutorial, you can write a .json file when Telegram makes a POST request (see example: here). I want to save the message object provided by the Telegram webhook (as showcased in the tutorial video). Using the webhook for getting updates is better than constantly querying the getUpdates() method; that method returns old messages also.
WHAT I'VE TRIED
I've tried to add:
ssl_context='adhoc'
to
app.run(debug=True, host='0.0.0.0', port=8443)
to make the connection HTTPS.
While using this ssl_context, loading the homepage isn't possible either..
PREFERABLE OUTPUT
When the user sends a message inside the Telegram chat --> Python saves a .json file of the message object.
You need to have SSL enabled for this to work. Telegram is trying to initiate an SSL session with your server, but you don't have SSL enabled, so you are seeing the bad request.
ssl_context='adhoc' may work for a test app, but I also have a hunch that telegram requires a VALID SSL certificate, not just an ad-hoc (or self-signed one). Notice the lock to the left of the URL in the video and the lack of a security warning that would be present with an invalid or self-signed certificate.
To make sure SSL is working set the ssl_context to adhoc, start the app, and browse to https://myprivatedomain.com:8443/index. If you can browse to it, then Telegram will also be able to browse to it, after getting a valid certificate, of course.
Next, to get a valid (and free) SSL certificate you can use LetsEncrypt.
Once you have a valid SSL certificate and key file you can pass the ssl_context argument to app.run with a tuple of the path to the certificate file and the path to the key file ("/path/to/fullchain.pem", "/path/to/privkey.pem")
Your full run function should look like this
app.run(debug=True, host='0.0.0.0', port=8443, ssl_context=("/path/to/fullchain.pem", "/path/to/privkey.pem"))
Alternatively you can use Apache or Nginx to secure your site with SSL, and reverse proxy to your bot. Those options would normally be used in a final product, so I understand if you don't want to get into the weeds with them right now, but it is good practice regardless.
Hopefully that helps.
I'm currently working on the Twilio SMS Quickstart; specifically I'm stuck on the "Reply to an incoming message using Twilio SMS".
*update, I've realized I haven't used the 'request' module I imported from Flask. Would appreciate any tips on if I need to utilize this module and, if I do, how do I use it in this specific script?
Up to this point I've successfully sent a message using a Twilio script called "send_sms.py". I'm now stuck with being unable use my virtualenv to receive and reply to messages. Here's the code titled 'run.py':
from flask import Flask, request
from twilio.twiml.messaging_response import MessagingResponse
app = Flask(__name__)
#app.route('/sms', methods=['POST'])
def sms_ahoy_reply():
"""Respond to incoming messages with a friendly SMS."""
# Start our response
resp = MessagingResponse()
# Add a message
resp.message("Ahoy! Thanks so much for your message.")
return str(resp)
if __name__ == "__main__":
app.run(debug=True)
I get an error from my code editor, Spyder, next to 'from flask import Flask, request'; however, when I delete ', request' the error goes away.
As a result of this issue I'm unable to successfully run the script which would allow me to receive and reply to text messages via Twilio.
I have built a SMS service (using Twilio) that the user texts to get realtime bus information. At the moment i have been hosting this on my personal computer using ngrok. Now i want to use AWS to host this service, but I am not sure as to how i should go about it. I have tried running a flask webserver and trying to get ngrok to run on AWS, but no luck.
Here is my code concerning Flask and Twilio's REST Api:
app = Flask(__name__)
#app.route("/sms", methods=['GET', 'POST'])
def hello_monkey():
resp = MessagingResponse()
response = request.form['Body']
if (" " in response):
response = response.split(" ")
result = look_up(response[0], response[1])
else:
result = look_up(response, False)
resp.message(result)
return str(resp)
if __name__ == "__main__":
app.run(debug=True)
There is a blog post on the Twilio blog on How to Send SMS Text Messages with AWS Lambda and Python 3.6. It does not use Flask, but it can definitely be modified to achieve your goal. Alternatively, you could read about using Flask with AWS Elastic Beanstalk here.
Running ngrok on AWS is not the correct approach to this. If you wanted to host your own Flask server, you could use something like Lightsail, but that's overkill for this usage.
I'm trying to implement a scipt on OpenShift, which works to bypass a very basic firewall in my college.
The aim is that I add the OpenShift address to the tracker list in any torrent I am running.
The client requests the script for peers.
The script accepts the peer list request and then asks for the list itself from a valid tracker. For testing purposes I have hardcoded this into the script as the tracker works for the test torrent without the firewall.
The response is passed back to the torrent client on my computer.
MyPC <==> Openshift <==> Tracker
This code is not working for some reason. I followed the flask quick start guide and the OpenShift getting started guide .
I am new to networking so please help me out.
This is the routes.py file:
#!/usr/bin/python
import os,urllib2
from flask import Flask
from flask import request
app=Flask(__name__)
app.config['PROPAGATE_EXCEPTIONS']=True
#app.route('/announce/')
def tormirror_test():
q=request.query_string
u=urllib2.urlopen("http://exodus.desync.com:6969/announce?"+str(q))
return u
#app.route("/<name>")
def insulter(name):
return "this is a test code====="+name
if __name__ == "__main__":
app.run()
I think part of it is that your university may be blocking the connection back to your computer from OpenShift. My guess is your university blocks incoming connections on port 6969
Just putting it here so you can mark it answered