sudo apt-get install python3-pip
sudo pip3 install virtualenv
| echo "zerando o firewall" | |
| iptables -F | |
| iptables -t nat -F | |
| iptables -t mangle -F | |
| iptables -P INPUT DROP | |
| iptables -P OUTPUT DROP | |
| iptables -P FORWARD ACCEPT | |
| echo 1 > /proc/sys/net/ipv4/ip_forward |
| iptables -A INPUT -p udp --sport 53 -j ACCEPT | |
| iptables -A OUTPUT -p udp --dport 53 -j ACCEPT | |
| iptables -A OUTPUT -p tcp --dport 443 -j ACCEPT | |
| iptables -A INPUT -p tcp --sport 443 -j ACCEPT | |
| iptables -A INPUT -p tcp --sport 80 -j ACCEPT | |
| iptables -A OUTPUT -p tcp --dport 80 -j ACCEPT |
| echo "zerando o firewall" | |
| iptables -F | |
| iptables -t nat -F | |
| iptables -t mangle -F | |
| iptables -P INPUT ACCEPT | |
| iptables -P OUTPUT ACCEPT | |
| iptables -P FORWARD ACCEPT | |
| Crie os seguintes cenários de rede: | |
| # 1. Mascare todos os pacotes de rede que saem da LAN para a Internet. | |
| echo 1 > /proc/sys/net/ipv4/ip_forward |
| import axios from "axios"; | |
| import { getToken } from "./auth"; | |
| const api = axios.create({ | |
| baseURL: "http://127.0.0.1:5000" | |
| }); | |
| api.interceptors.request.use(async config => { | |
| const token = getToken(); | |
| if (token) { |
| def add_cors_headers(response): | |
| response.headers['Access-Control-Allow-Origin'] = '*' | |
| if request.method == 'OPTIONS': | |
| response.headers['Access-Control-Allow-Methods'] = 'DELETE, GET, POST, PUT' | |
| headers = request.headers.get('Access-Control-Request-Headers') | |
| if headers: | |
| response.headers['Access-Control-Allow-Headers'] = headers | |
| return response | |
| app.after_request(add_cors_headers) |
| import urllib2 | |
| import datetime | |
| import json | |
| import urlparse | |
| from multiprocessing import Pool | |
| num = 725 | |
| qtDivs = 4 | |
| numvet = [] | |
| vetDivs = [] |
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| import datetime | |
| dat1 = '1994-10-08T23:14:05Z' | |
| dat2 = str(datetime.datetime.date(datetime.datetime.now())) | |
| dat1f = dat1.split("T")[0] | |
| d1 = datetime.datetime.strptime(dat1f, "%Y-%m-%d") |
| def byteify(input): | |
| if isinstance(input, dict): | |
| return {byteify(key): byteify(value) | |
| for key, value in input.iteritems()} | |
| elif isinstance(input, list): | |
| return [byteify(element) for element in input] | |
| elif isinstance(input, unicode): | |
| return input.encode('utf-8') | |
| else: | |
| return input |