This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local resty_rsa = require "resty.rsa" | |
local b64 = require("ngx.base64") | |
-- local rsa_public_key, rsa_priv_key, err = resty_rsa:generate_rsa_keys(2048) | |
-- if not rsa_public_key then | |
-- ngx.say('generate rsa keys err: ', err) | |
-- end | |
local algorithm = "SHA256" | |
local key = "MHwwDQYJKoZIhvcNAQEBBQADawAwaAJhAOz0YTcc5qsRSyNYUBPD/6H/vcbFqtTb+IcW45PAZ5lMIMj4DLdNF+/4ZlVSVKU9QfC5lio/X76sZhwG2u+7vwOBi1awuwQ91xVroeR4ozpRqs31DYDl7uCfbMZhbG2m4wIDAQAB" | |
local rsa_public_key = "-----BEGIN PUBLIC KEY-----\n" .. key .. "\n-----END PUBLIC KEY-----" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local pkey = require("resty.openssl.pkey") | |
local base64_decode = ngx.decode_base64 | |
local openssl_x509 = require("resty.openssl.x509") | |
-- local b64 = "MIIBiTCCAROgAwIBAgICA+gwDQYJKoZIhvcNAQELBQAwFjEUMBIGA1UEAwwLZXhh\nbXBsZS5jb20wHhcNMjIxMDA2MTAwNTQ5WhcNMzIxMDAzMTAwNTQ5WjAWMRQwEgYD\nVQQDDAtleGFtcGxlLmNvbTB8MA0GCSqGSIb3DQEBAQUAA2sAMGgCYQDs9GE3HOar\nEUsjWFATw/+h/73GxarU2/iHFuOTwGeZTCDI+Ay3TRfv+GZVUlSlPUHwuZYqP1++\nrGYcBtrvu78DgYtWsLsEPdcVa6HkeKM6UarN9Q2A5e7gn2zGYWxtpuMCAwEAAaMr\nMCkwDwYDVR0TBAgwBgEB/wIBADAWBgNVHREEDzANggtleGFtcGxlLmNvbTANBgkq\nhkiG9w0BAQsFAANhAERnjq9SMzRGIzOb5N3JAuv1w18GSceKjqNGscisyVkIEWTf\n5hUm2NaVrFA65o7STucxdxN5Y7ydBVvDY+7pA8TicqE36BKwXC3cUU5HGyQw+D1K\ndnff2J0hDORtyhLsxw==" | |
-- local certstring = "-----BEGIN CERTIFICATE-----\n" .. b64 .. "\n-----END CERTIFICATE-----" | |
-- local orig_rsa_public_key | |
-- local cert,err = openssl_x509.new(certstring, "PEM") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jwt | |
from datetime import datetime, timedelta | |
import ipaddress | |
import time | |
from cryptography.hazmat.primitives import serialization | |
from cryptography.x509 import load_pem_x509_certificate | |
# pip3 install signxml | |
from lxml import etree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> public_key | |
'-----BEGIN PUBLIC KEY-----\nMHwwDQYJKoZIhvcNAQEBBQADawAwaAJhAOz0YTcc5qsRSyNYUBPD/6H/vcbFqtTb\n+IcW45PAZ5lMIMj4DLdNF+/4ZlVSVKU9QfC5lio/X76sZhwG2u+7vwOBi1awuwQ9\n1xVroeR4ozpRqs31DYDl7uCfbMZhbG2m4wIDAQAB\n-----END PUBLIC KEY-----\n' | |
>>> private_key | |
b'-----BEGIN RSA PRIVATE KEY-----\nMIIBzAIBAAJhAOz0YTcc5qsRSyNYUBPD/6H/vcbFqtTb+IcW45PAZ5lMIMj4DLdN\nF+/4ZlVSVKU9QfC5lio/X76sZhwG2u+7vwOBi1awuwQ91xVroeR4ozpRqs31DYDl\n7uCfbMZhbG2m4wIDAQABAmEA4IyuW+Ydilu3EuWr7S8+X6zVkTrdKx7SJGLCg9A/\n3PxRzWGT21lJp/WENLLy2Cx1L+HOSQ1XVaCUD4KKOY6YpDpPMa6OYBRq+7JhasIc\nQtNJk67LQdLsye/XNAWFUB7xAjEA+vPa92brCLMFGQDbZ1GUQe/pfw6eoFWCg9TC\nlfaKdDvqd2ygYupMmNxWrSlt11elAjEA8bhzE6sarsTunj0JOBk8MmzGmirP6qTK\nlsLMwMehZbCpf4uOGURCwP7K7jkzan3nAjEA98NKrHgwFKaqocT22Urx1SfIoGkO\ns7243e9xLh37FEcTdlUJBJ/OgB0KdmwwxisBAjA4R6TrkGwvAwU37Kgn2qBMcU0w\negVc8a+FuKdpv1FR1vcwDjMwqNcODoT7QHA7PEMCMQDvv3k5nFwQ2+wnDGQs00vg\nX77tghZPvWmYfMNWKFNCNPz2gJ4YL7jCU3aotyzEDYQ=\n-----END RSA PRIVATE KEY-----\n' | |
>>> cert | |
b'-----BEGIN CERTIFICATE-----\nMIIBiTCCAROgAw |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jwt | |
from datetime import datetime, timedelta | |
import ipaddress | |
import time | |
from cryptography.hazmat.primitives import serialization | |
from cryptography.x509 import load_pem_x509_certificate | |
def generate_selfsigned_cert(hostname, ip_addresses=None, key=None): | |
"""Generates self signed certificate for a hostname, and optional IP addresses.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local resty_rsa = require "resty.rsa" | |
local codec = require "kong.openid-connect.codec" | |
local base64url = codec.base64url | |
local algorithm = "SHA256" | |
ngx.say('---') | |
-- substitute your "key" here | |
local k = "MHwwDQYJKoZIhvcNAQEBBQADawAwaAJhANGkBcOBvBWEzSfRYErqBpQByj0LMiV6+CTr274ZHlT7rlegHx2AxGK7l2hpl6Da8tJf1sQmHFq7T8bdrR12zB8TvXcLpkkbK6tVverJh+bGqbSqjDZPoRuhvZdpDb6ziQIDAQAB" | |
local orig_rsa_public_key = "-----BEGIN PUBLIC KEY-----\n" .. k .. "\n-----END PUBLIC KEY-----" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local resty_rsa = require "resty.rsa" | |
local codec = require "kong.openid-connect.codec" | |
local base64url = codec.base64url | |
local openssl_x509 = require("resty.openssl.x509") | |
local b64 = "MIICmzCCAYMCBgGC3hTanzANBgkqhkiG9w0BAQsFADARMQ8wDQYDVQQDDAZrb25nLWgwHhcNMjIwODI3MDY1MzA0WhcNMzIwODI3MDY1NDQ0WjARMQ8wDQYDVQQDDAZrb25nLWgwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCj36hSXWB+9j/YqHnXkPUjNQz9IR/EWQRXNFEome6JmV6ulBU9vt4wmi1b2xjmoD+Z8uBg15khZ776ftmnJvZesk0CDq9OJW3niGgXwPGsXWf0E39fZrBdGL1EM9vLwSqqyTETNabqD/lsgA4rwIVWr+z0vMXvwGB4LYW/LNOzUy6V7mmAuPxg2ixlmCNLw/ACAvqKcdBypl8Xh9B/A+eMk5p3OT/7BRaAiF49JJEkctZThE5YBwYC+IZ+8qXEC66t0MmcojgnQnaYwS4ZBmrcOg3s1QLnsUavUxtdvQsLk+ORy5LBXelcereHGdp/50R7JwLAkzkAruTi2D1B0vRlAgMBAAEwDQYJKoZIhvcNAQELBQADggEBAIKVnA2hpuZVwvAlT1CYXzDUEoHQt9K3L/kSemURtxkiF8vTkjw19nmieDmpxVR2S1bIR/B+Bmgv0jS0ieL33AbHgGfpgE0oWZ2nUO53VzgNexCnSOPuCQevHEFbaRRkjZtoAQJdMriE0khSSZlgjlUlgsjIteY/S6xKVUw/iEU1xWLVcICNaqt1IUwfOX6omkEmSTEAFhkEj7lFEEekBPfQ0Sa9rOxmEnpkUY+I3k8YAlEWnFCdkV7lM5PlHdgmwFsnNlN7khec3bK5ku2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM python:3.10-slim-buster | |
WORKDIR /src | |
#COPY requirements.txt . | |
#RUN pip install -r requirements.txt | |
COPY server2.py server2.py | |
CMD ["python", "-u", "server2.py"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from IOTSocket import IOTSocketClient as sock | |
import time | |
from clrprint import * | |
host = '144.126.254.36' | |
port = 5000 | |
device_id = '1234567890' | |
device_key ='1432qrzd23' | |
prev_call = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
url = "https://judge0-ce.p.rapidapi.com/submissions" | |
rapidapi_key = "I'll whatsapp you" | |
querystring = {"base64_encoded":"true","fields":"*"} | |
payload = { | |
"language_id": 52, |