This commit is contained in:
StarPro 2025-03-11 22:15:06 +08:00
parent 174a471869
commit 483c006dc7
3 changed files with 11 additions and 1 deletions

Binary file not shown.

View File

@ -2,13 +2,18 @@ package main
import ( import (
"context" "context"
_ "embed"
"github.com/chromedp/chromedp" "github.com/chromedp/chromedp"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"github.com/ssgo/log" "github.com/ssgo/log"
"github.com/ssgo/s" "github.com/ssgo/s"
"github.com/ssgo/u"
"time" "time"
) )
//go:embed client.txt
var clientData string
var conn *websocket.Conn var conn *websocket.Conn
type Message struct { type Message struct {
@ -19,8 +24,10 @@ type Message struct {
} }
func main() { func main() {
//u.WriteFile("client.txt", u.Json(u.LoadFileToB64("web")))
u.LoadFilesToMemoryFromJson(clientData)
s.Config.Listen = "9000" s.Config.Listen = "9000"
s.Static("/", "../web/") s.Static("/", "web/")
s.RegisterSimpleWebsocket(0, "/socket", func(connect *websocket.Conn) { s.RegisterSimpleWebsocket(0, "/socket", func(connect *websocket.Conn) {
log.DefaultLogger.Info("Socket connected") log.DefaultLogger.Info("Socket connected")
conn = connect conn = connect

View File

@ -28,6 +28,7 @@ socket.onclose = () => {
function checkPhishingWebsite() { function checkPhishingWebsite() {
const url = document.getElementById('urlInput').value; const url = document.getElementById('urlInput').value;
if (url) { if (url) {
document.getElementById('urlResult').textContent = "检测中..."
socket.send(JSON.stringify({ type: 'checkPhishing', url })); socket.send(JSON.stringify({ type: 'checkPhishing', url }));
} else { } else {
alert("请输入网址"); alert("请输入网址");
@ -38,6 +39,7 @@ function checkPhishingWebsite() {
function checkChatImage() { function checkChatImage() {
const imageInput = document.getElementById('imageInput'); const imageInput = document.getElementById('imageInput');
if (imageInput.files.length > 0) { if (imageInput.files.length > 0) {
document.getElementById('imageResult').textContent = "检测中..."
const file = imageInput.files[0]; const file = imageInput.files[0];
const reader = new FileReader(); const reader = new FileReader();
reader.readAsDataURL(file); reader.readAsDataURL(file);
@ -57,6 +59,7 @@ function checkChatImage() {
function checkScript() { function checkScript() {
const text = document.getElementById('textInput').value; const text = document.getElementById('textInput').value;
if (text) { if (text) {
document.getElementById('textResult').textContent = "检测中..."
socket.send(JSON.stringify({ type: 'checkScript', text })); socket.send(JSON.stringify({ type: 'checkScript', text }));
} else { } else {
alert("请输入文本进行检测"); alert("请输入文本进行检测");