Spaces:
Runtime error
Runtime error
Commit
•
feb9bdc
0
Parent(s):
Duplicate from Yusin/docker_test
Browse files- .gitattributes +34 -0
- Dockerfile +52 -0
- README.md +14 -0
- aberconnect.sh +27 -0
- docker-compose.yaml +8 -0
- main.py +54 -0
- requirements.txt +0 -0
.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
Dockerfile
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
2 |
+
# you will also find guides on how best to write your Dockerfile
|
3 |
+
FROM ubuntu:22.04
|
4 |
+
|
5 |
+
RUN apt-get update
|
6 |
+
|
7 |
+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
8 |
+
sudo \
|
9 |
+
build-essential \
|
10 |
+
gettext \
|
11 |
+
autoconf \
|
12 |
+
automake \
|
13 |
+
libproxy-dev \
|
14 |
+
libxml2-dev \
|
15 |
+
libtool \
|
16 |
+
vpnc-scripts \
|
17 |
+
pkg-config \
|
18 |
+
libgnutls28-dev \
|
19 |
+
git \
|
20 |
+
expect
|
21 |
+
|
22 |
+
RUN apt-get update \
|
23 |
+
&& apt-get install -y python3-pip python3-dev \
|
24 |
+
&& cd /usr/local/bin \
|
25 |
+
&& ln -s -f /usr/bin/python3 python \
|
26 |
+
&& pip3 --no-cache-dir install --upgrade pip \
|
27 |
+
&& rm -rf /var/lib/apt/lists/*
|
28 |
+
|
29 |
+
RUN git clone https://github.com/openconnect/openconnect.git
|
30 |
+
|
31 |
+
WORKDIR /openconnect
|
32 |
+
RUN ./autogen.sh
|
33 |
+
RUN ./configure
|
34 |
+
RUN make
|
35 |
+
|
36 |
+
COPY requirements.txt /openconnect/requirements.txt
|
37 |
+
RUN python -m pip install -r /openconnect/requirements.txt
|
38 |
+
|
39 |
+
USER root
|
40 |
+
|
41 |
+
RUN mkdir -p /var/run/vpnc
|
42 |
+
RUN chmod -R 777 /var/run/vpnc
|
43 |
+
|
44 |
+
RUN cat /dev/net/tun
|
45 |
+
|
46 |
+
RUN mkdir -p /dev/net
|
47 |
+
RUN mknod /dev/net/tun c 10 200
|
48 |
+
RUN chmod 600 /dev/net/tun
|
49 |
+
|
50 |
+
COPY aberconnect.sh /openconnect
|
51 |
+
RUN chmod +x aberconnect.sh
|
52 |
+
ENTRYPOINT ["./aberconnect.sh"]
|
README.md
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Docker Test
|
3 |
+
emoji: 🏢
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: purple
|
6 |
+
sdk: docker
|
7 |
+
app_file: main.py
|
8 |
+
app_port: 7860
|
9 |
+
pinned: false
|
10 |
+
license: apache-2.0
|
11 |
+
duplicated_from: Yusin/docker_test
|
12 |
+
---
|
13 |
+
|
14 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
aberconnect.sh
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/expect -f
|
2 |
+
|
3 |
+
set timeout -1
|
4 |
+
|
5 |
+
set username yuxing.chen@unitn.it
|
6 |
+
set password cyx521301
|
7 |
+
|
8 |
+
spawn ./openconnect --protocol=gp vpn.icts.unitn.it --user=$username
|
9 |
+
|
10 |
+
expect "Password:*"
|
11 |
+
send -- "$password\r"
|
12 |
+
|
13 |
+
expect eof
|
14 |
+
|
15 |
+
|
16 |
+
##!/bin/bash
|
17 |
+
#/usr/bin/expect <<EOF
|
18 |
+
# set timeout -1
|
19 |
+
# set username yuxing.chen@unitn.it
|
20 |
+
# set password cyx521301
|
21 |
+
# spawn ./openconnect --protocol=gp vpn.icts.unitn.it --user=$username
|
22 |
+
# expect {
|
23 |
+
# "Password:*" {
|
24 |
+
# send -- "$password\r"
|
25 |
+
# }
|
26 |
+
# }
|
27 |
+
#EOF
|
docker-compose.yaml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
version: "3"
|
2 |
+
services:
|
3 |
+
bot:
|
4 |
+
build:
|
5 |
+
context: .
|
6 |
+
restart: "no"
|
7 |
+
# Add shm_size otherwise chrome will crash due to lack of memory.
|
8 |
+
shm_size: 512m
|
main.py
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
'''
|
3 |
+
import os
|
4 |
+
session_token = os.environ.get('SessionToken')
|
5 |
+
conversation_id = os.environ.get('conversation_id')
|
6 |
+
from revChatGPT.ChatGPT import Chatbot
|
7 |
+
chatbot = Chatbot({"session_token": session_token}) # You can start a custom conversation
|
8 |
+
|
9 |
+
|
10 |
+
import undetected_chromedriver.v2 as uc
|
11 |
+
from selenium.webdriver.support import expected_conditions as EC
|
12 |
+
from selenium.webdriver.support.ui import WebDriverWait
|
13 |
+
from selenium.webdriver.common.by import By
|
14 |
+
|
15 |
+
|
16 |
+
def get_element_or_none(driver, xpath, wait=None):
|
17 |
+
try:
|
18 |
+
if wait is None:
|
19 |
+
return driver.find_element(By.XPATH, xpath)
|
20 |
+
else:
|
21 |
+
return WebDriverWait(driver, wait).until(
|
22 |
+
EC.presence_of_element_located((By.XPATH, xpath)))
|
23 |
+
except:
|
24 |
+
return None
|
25 |
+
|
26 |
+
|
27 |
+
def run():
|
28 |
+
print("Welcome to game of Tom and Jerry. Here Cloudflare is the cat, Jerry is the Programmer. Our Goal as a good Jerry is to trick Cloudflare.")
|
29 |
+
|
30 |
+
options = uc.ChromeOptions()
|
31 |
+
options.arguments.extend(
|
32 |
+
["--no-sandbox", "--disable-setuid-sandbox"])
|
33 |
+
print("Creating Driver...")
|
34 |
+
driver = uc.Chrome(
|
35 |
+
options=options
|
36 |
+
)
|
37 |
+
print("Created Driver...")
|
38 |
+
|
39 |
+
driver.get('https://nowsecure.nl')
|
40 |
+
|
41 |
+
element = get_element_or_none(driver, "/html/body/div[2]/div/main/h1", 20)
|
42 |
+
if element is not None:
|
43 |
+
print("We defeated Cloudflare, 🎉🥳 :)")
|
44 |
+
else:
|
45 |
+
print("Cloudflare defeated us :(, No woory we will try again. ")
|
46 |
+
driver.quit()
|
47 |
+
'''
|
48 |
+
|
49 |
+
if __name__ == "__main__":
|
50 |
+
#run()
|
51 |
+
headers = {'Authorization': 'yusin'}
|
52 |
+
data = {"content": 'am I stupid'}
|
53 |
+
response = requests.post('http://93.56.204.222:7788/api/ask', headers=headers, json=data)
|
54 |
+
print('this is my answear', response.text)
|
requirements.txt
ADDED
File without changes
|