Files
python----/智慧校园/智慧校园 copy.ipynb
2025-10-20 12:32:18 +08:00

28 KiB

In [2]:
from requests import get,post
In [6]:
get("http://192.168.0.244:8100/culum/tea/get?id=14&access_token=11f0a07a-b6cb-4b1b-a1a4-9b83f90c9075").text
Out [6]:
'{"success":false,"msg":"非法访问,没有认证","code":10007,"data":null}'
In [30]:
post("http://192.168.0.205:8100/door/accredit/sendNews?access_token=649cb490-214b-45a1-997d-18e84e9348e3",json={"startTime":"25091515","endTime":"28061215","adminType":"55","type":"01","time":[1757919929119,1844406329119],"accountIp":"192.168.0.111","accountName":"NRSKKLYXDQTXUTJ","lockNo":"8686987","category":2,"serialNo":"","addAdminBand":"","addUserBand":"","removeBand":"3172414151,31313122222","doorAccreditIds":"6891,6892"}).text
---------------------------------------------------------------------------
ConnectionRefusedError                    Traceback (most recent call last)
File d:\Anaconda3\Lib\site-packages\urllib3\connection.py:196, in HTTPConnection._new_conn(self)
    195 try:
--> 196     sock = connection.create_connection(
    197         (self._dns_host, self.port),
    198         self.timeout,
    199         source_address=self.source_address,
    200         socket_options=self.socket_options,
    201     )
    202 except socket.gaierror as e:

File d:\Anaconda3\Lib\site-packages\urllib3\util\connection.py:85, in create_connection(address, timeout, source_address, socket_options)
     84 try:
---> 85     raise err
     86 finally:
     87     # Break explicitly a reference cycle

File d:\Anaconda3\Lib\site-packages\urllib3\util\connection.py:73, in create_connection(address, timeout, source_address, socket_options)
     72     sock.bind(source_address)
---> 73 sock.connect(sa)
     74 # Break explicitly a reference cycle

ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

The above exception was the direct cause of the following exception:

NewConnectionError                        Traceback (most recent call last)
File d:\Anaconda3\Lib\site-packages\urllib3\connectionpool.py:789, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)
    788 # Make the request on the HTTPConnection object
--> 789 response = self._make_request(
    790     conn,
    791     method,
    792     url,
    793     timeout=timeout_obj,
    794     body=body,
    795     headers=headers,
    796     chunked=chunked,
    797     retries=retries,
    798     response_conn=response_conn,
    799     preload_content=preload_content,
    800     decode_content=decode_content,
    801     **response_kw,
    802 )
    804 # Everything went great!

File d:\Anaconda3\Lib\site-packages\urllib3\connectionpool.py:495, in HTTPConnectionPool._make_request(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)
    494 try:
--> 495     conn.request(
    496         method,
    497         url,
    498         body=body,
    499         headers=headers,
    500         chunked=chunked,
    501         preload_content=preload_content,
    502         decode_content=decode_content,
    503         enforce_content_length=enforce_content_length,
    504     )
    506 # We are swallowing BrokenPipeError (errno.EPIPE) since the server is
    507 # legitimately able to close the connection after sending a valid response.
    508 # With this behaviour, the received response is still readable.

File d:\Anaconda3\Lib\site-packages\urllib3\connection.py:398, in HTTPConnection.request(self, method, url, body, headers, chunked, preload_content, decode_content, enforce_content_length)
    397     self.putheader(header, value)
--> 398 self.endheaders()
    400 # If we're given a body we start sending that in chunks.

File d:\Anaconda3\Lib\http\client.py:1331, in HTTPConnection.endheaders(self, message_body, encode_chunked)
   1330     raise CannotSendHeader()
-> 1331 self._send_output(message_body, encode_chunked=encode_chunked)

File d:\Anaconda3\Lib\http\client.py:1091, in HTTPConnection._send_output(self, message_body, encode_chunked)
   1090 del self._buffer[:]
-> 1091 self.send(msg)
   1093 if message_body is not None:
   1094 
   1095     # create a consistent interface to message_body

File d:\Anaconda3\Lib\http\client.py:1035, in HTTPConnection.send(self, data)
   1034 if self.auto_open:
-> 1035     self.connect()
   1036 else:

File d:\Anaconda3\Lib\site-packages\urllib3\connection.py:236, in HTTPConnection.connect(self)
    235 def connect(self) -> None:
--> 236     self.sock = self._new_conn()
    237     if self._tunnel_host:
    238         # If we're tunneling it means we're connected to our proxy.

File d:\Anaconda3\Lib\site-packages\urllib3\connection.py:211, in HTTPConnection._new_conn(self)
    210 except OSError as e:
--> 211     raise NewConnectionError(
    212         self, f"Failed to establish a new connection: {e}"
    213     ) from e
    215 # Audit hooks are only available in Python 3.8+

NewConnectionError: <urllib3.connection.HTTPConnection object at 0x0000024767489A60>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

The above exception was the direct cause of the following exception:

MaxRetryError                             Traceback (most recent call last)
File d:\Anaconda3\Lib\site-packages\requests\adapters.py:589, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
    588 try:
--> 589     resp = conn.urlopen(
    590         method=request.method,
    591         url=url,
    592         body=request.body,
    593         headers=request.headers,
    594         redirect=False,
    595         assert_same_host=False,
    596         preload_content=False,
    597         decode_content=False,
    598         retries=self.max_retries,
    599         timeout=timeout,
    600         chunked=chunked,
    601     )
    603 except (ProtocolError, OSError) as err:

File d:\Anaconda3\Lib\site-packages\urllib3\connectionpool.py:843, in HTTPConnectionPool.urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)
    841     new_e = ProtocolError("Connection aborted.", new_e)
--> 843 retries = retries.increment(
    844     method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2]
    845 )
    846 retries.sleep()

File d:\Anaconda3\Lib\site-packages\urllib3\util\retry.py:519, in Retry.increment(self, method, url, response, error, _pool, _stacktrace)
    518     reason = error or ResponseError(cause)
--> 519     raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
    521 log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)

MaxRetryError: HTTPConnectionPool(host='192.168.0.205', port=8100): Max retries exceeded with url: /door/accredit/sendNews?access_token=649cb490-214b-45a1-997d-18e84e9348e3 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000024767489A60>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。'))

During handling of the above exception, another exception occurred:

ConnectionError                           Traceback (most recent call last)
Cell In[30], line 1
----> 1 post("http://192.168.0.205:8100/door/accredit/sendNews?access_token=649cb490-214b-45a1-997d-18e84e9348e3",json={"startTime":"25091515","endTime":"28061215","adminType":"55","type":"01","time":[1757919929119,1844406329119],"accountIp":"192.168.0.111","accountName":"NRSKKLYXDQTXUTJ","lockNo":"8686987","category":2,"serialNo":"","addAdminBand":"","addUserBand":"","removeBand":"3172414151,31313122222","doorAccreditIds":"6891,6892"}).text

File d:\Anaconda3\Lib\site-packages\requests\api.py:115, in post(url, data, json, **kwargs)
    103 def post(url, data=None, json=None, **kwargs):
    104     r"""Sends a POST request.
    105 
    106     :param url: URL for the new :class:`Request` object.
   (...)
    112     :rtype: requests.Response
    113     """
--> 115     return request("post", url, data=data, json=json, **kwargs)

File d:\Anaconda3\Lib\site-packages\requests\api.py:59, in request(method, url, **kwargs)
     55 # By using the 'with' statement we are sure the session is closed, thus we
     56 # avoid leaving sockets open which can trigger a ResourceWarning in some
     57 # cases, and look like a memory leak in others.
     58 with sessions.Session() as session:
---> 59     return session.request(method=method, url=url, **kwargs)

File d:\Anaconda3\Lib\site-packages\requests\sessions.py:589, in Session.request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    584 send_kwargs = {
    585     "timeout": timeout,
    586     "allow_redirects": allow_redirects,
    587 }
    588 send_kwargs.update(settings)
--> 589 resp = self.send(prep, **send_kwargs)
    591 return resp

File d:\Anaconda3\Lib\site-packages\requests\sessions.py:703, in Session.send(self, request, **kwargs)
    700 start = preferred_clock()
    702 # Send the request
--> 703 r = adapter.send(request, **kwargs)
    705 # Total elapsed time of the request (approximately)
    706 elapsed = preferred_clock() - start

File d:\Anaconda3\Lib\site-packages\requests\adapters.py:622, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
    618     if isinstance(e.reason, _SSLError):
    619         # This branch is for urllib3 v1.22 and later.
    620         raise SSLError(e, request=request)
--> 622     raise ConnectionError(e, request=request)
    624 except ClosedPoolError as e:
    625     raise ConnectionError(e, request=request)

ConnectionError: HTTPConnectionPool(host='192.168.0.205', port=8100): Max retries exceeded with url: /door/accredit/sendNews?access_token=649cb490-214b-45a1-997d-18e84e9348e3 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000024767489A60>: Failed to establish a new connection: [WinError 10061] 由于目标计算机积极拒绝,无法连接。'))
In [ ]:
"SELECT *,(SELECT COUNT(1) FROM FRM_DEPARTMENT WHERE A.GLBM = FRM_DEPARTMENT.SJBM) AS XJDWGS FROM ("
+ " SELECT * FROM FRM_DEPARTMENT WHERE 1=1 "
+ " and SJBM = '" + sjbm + "'"
+ " ORDER BY GLBM ) AS A "
+ " ORDER BY glbm"
In [15]:
header = {
    "authorization":'''eyJhbGciOiJIUzUxMiIsInppcCI6IkRFRiJ9.eNo0y9EKgzAMheF3yXUDjWla49tYzIXbmKPtxkB8d-1gdz8f5-xwaytMQJFNbRDMEhnDohl18RFZOI1JdSYScFDfuY-vWmu9qm13e2K18rHScW4wURKWwauwA_u-_kBjh7I9rB_J_ZSYyIeQ4DgBAAD__w.PMebNf9aPLD-mQv784XFRqeiuGD-RbflMKHShWVG_s0nfgmmoogquEvp448uXCjjK_qQamX0eqTnL9-qtnRO6Q'''
}
In [13]:
data = get("http://192.168.0.111:9966/account/login?tokenKey=get&appId=1&timestamp=0&methodName=login&userKey=FH0DH2&password=RGV2ZWxvcDg4OA%3D%3D").json()
token = data.get("results", {}).get("tokenKey", "")
key = data.get("results", {}).get("userKey", "")
In [ ]:
('z16tcjymrde1c4ry', 'rck19l')
In [14]:
post("http://192.168.0.111:9966/account/login",json={"appId":"1","methodName":"login","password":token,"timestamp":"Sat, 26 Jul 2025 08:37:17 GMT","userKey":key}).text
Out [14]:
'{"code":4006,"message":"用户名或者密码错误超过5次数,请10分钟之后重试","success":false}'
In [ ]:
INSERT INTO auth_resource(id, code, name, parentid, uri, type, method, icon, status, createtime, updatetime) 
VALUES (2, 'rhfxcgindex', '车管业务', null, '', 1, 'GET', NULL, 1, CURRENT_TIMESTAMP, NULL),
       (3, 'rhfxcgindex01', '允许访问页面', 2, 'rhfxcgindex', 3, 'GET', NULL, 1, CURRENT_TIMESTAMP, NULL);
In [4]:
get("http://192.168.0.111:9966/userrolepermission/judgerole",headers=header).text
Out [4]:
'{"success":true,"code":200,"message":"成功","results":[]}'
In [18]:
get("http://192.168.0.111:9966/addResource/addResource",headers=header,params={"prename":None,"name":"车管业务","filename":"rhfxcgindex"}).text
Out [18]:
'java.net.SocketTimeoutException: Read timed out'