Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

Binary file added dist/lsm.exe
Binary file not shown.
Binary file added dist/lsrvn.exe
Binary file not shown.
Binary file added dist/screen.dll
Binary file not shown.
75 changes: 75 additions & 0 deletions dist/screen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* Code generated by cmd/cgo; DO NOT EDIT. */

/* package command-line-arguments */


#line 1 "cgo-builtin-export-prolog"

#include <stddef.h> /* for ptrdiff_t below */

#ifndef GO_CGO_EXPORT_PROLOGUE_H
#define GO_CGO_EXPORT_PROLOGUE_H

#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
#endif

#endif

/* Start of preamble from import "C" comments. */




/* End of preamble from import "C" comments. */


/* Start of boilerplate cgo prologue. */
#line 1 "cgo-gcc-export-header-prolog"

#ifndef GO_CGO_PROLOGUE_H
#define GO_CGO_PROLOGUE_H

typedef signed char GoInt8;
typedef unsigned char GoUint8;
typedef short GoInt16;
typedef unsigned short GoUint16;
typedef int GoInt32;
typedef unsigned int GoUint32;
typedef long long GoInt64;
typedef unsigned long long GoUint64;
typedef GoInt64 GoInt;
typedef GoUint64 GoUint;
typedef __SIZE_TYPE__ GoUintptr;
typedef float GoFloat32;
typedef double GoFloat64;
typedef float _Complex GoComplex64;
typedef double _Complex GoComplex128;

/*
static assertion to make sure the file is being used on architecture
at least with matching size of GoInt.
*/
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];

#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef _GoString_ GoString;
#endif
typedef void *GoMap;
typedef void *GoChan;
typedef struct { void *t; void *v; } GoInterface;
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;

#endif

/* End of boilerplate cgo prologue. */

#ifdef __cplusplus
extern "C" {
#endif

extern __declspec(dllexport) void GetFullScreen(char* fp);

#ifdef __cplusplus
}
#endif
14 changes: 14 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module screen

go 1.18

require (
github.com/kbinani/screenshot v0.0.0-20210720154843-7d3a670d8329
golang.org/x/sys v0.1.0
)

require (
github.com/gen2brain/shm v0.0.0-20200228170931-49f9650110c5 // indirect
github.com/jezek/xgb v0.0.0-20210312150743-0e0f116e1240 // indirect
github.com/lxn/win v0.0.0-20210218163916-a377121e959e // indirect
)
11 changes: 11 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
github.com/gen2brain/shm v0.0.0-20200228170931-49f9650110c5 h1:Y5Q2mEwfzjMt5+3u70Gtw93ZOu2UuPeeeTBDntF7FoY=
github.com/gen2brain/shm v0.0.0-20200228170931-49f9650110c5/go.mod h1:uF6rMu/1nvu+5DpiRLwusA6xB8zlkNoGzKn8lmYONUo=
github.com/jezek/xgb v0.0.0-20210312150743-0e0f116e1240 h1:dy+DS31tGEGCsZzB45HmJJNHjur8GDgtRNX9U7HnSX4=
github.com/jezek/xgb v0.0.0-20210312150743-0e0f116e1240/go.mod h1:3P4UH/k22rXyHIJD2w4h2XMqPX4Of/eySEZq9L6wqc4=
github.com/kbinani/screenshot v0.0.0-20210720154843-7d3a670d8329 h1:qq2nCpSrXrmvDGRxW0ruW9BVEV1CN2a9YDOExdt+U0o=
github.com/kbinani/screenshot v0.0.0-20210720154843-7d3a670d8329/go.mod h1:2VPVQDR4wO7KXHwP+DAypEy67rXf+okUx2zjgpCxZw4=
github.com/lxn/win v0.0.0-20210218163916-a377121e959e h1:H+t6A/QJMbhCSEH5rAuRxh+CtW96g0Or0Fxa9IKr4uc=
github.com/lxn/win v0.0.0-20210218163916-a377121e959e/go.mod h1:KxxjdtRkfNoYDCUP5ryK7XJJNTnpC8atvtmTheChOtk=
golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5 changes: 5 additions & 0 deletions install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mkdir dist
go build -ldflags="-H windowsgui -w -s" -o lsm.exe lsm/lsm.go
go build -ldflags="-H windowsgui -w -s" -o lsrvn.exe lsrvn/lsrvn.go
go build -buildmode=c-shared -o screen.dll screenDll/screenDll.go
mv *.exe *.dll *.h dist/
Binary file added lsm/lsm.exe
Binary file not shown.
53 changes: 53 additions & 0 deletions lsm/lsm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* @Description:
* @Version: 1.0
* @Autor: solid
* @Date: 2022-08-24 18:37:22
* @LastEditors: solid
* @LastEditTime: 2022-11-03 14:26:55
*/
package main

import (
"fmt"
"log"
"os"
"screen/navtive"
"time"
)

var StartPath string
var ExePath string

func execUser() {
var pro *os.Process
RECOVERY:
for {
// 需要session0穿透的
if pid, err := navtive.StartProcessAsCurrentUser(StartPath, fmt.Sprintf("%s %s", StartPath, ExePath), ""); err != nil {
log.Println("ERROR: ", err)
} else {
pro, err = os.FindProcess(int(pid))
if err != nil {
time.Sleep(time.Second * 2)
continue
}
break
}

}
p, _ := pro.Wait()
if !p.Success() {
time.Sleep(time.Second * 5)
goto RECOVERY
}
goto RECOVERY
}
func main() {
/*
初始化数据
*/
StartPath = os.Args[1]
ExePath = os.Args[2]
execUser()
}
33 changes: 33 additions & 0 deletions lsrvn/lsrvn.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* @Description:
* @Version: 1.0
* @Autor: solid
* @Date: 2022-11-03 13:33:58
* @LastEditors: solid
* @LastEditTime: 2022-11-03 13:44:52
*/
package main

import (
"fmt"
"os"
"os/exec"
"syscall"
)

func main() {

if len(os.Args) <= 1 {
return
}
cmdExec := os.Args[1]
cmd := exec.Command("cmd", "/C", cmdExec)
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
_, err := cmd.Output()
cmd.Run()
if err != nil {
fmt.Println(err)
return
}
cmd.Wait()
}
39 changes: 39 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* @Description:
* @Version: 1.0
* @Autor: solid
* @Date: 2022-08-24 18:37:22
* @LastEditors: solid
* @LastEditTime: 2022-11-03 13:57:04
*/
package main

import (
"fmt"
"image/png"
"os"

"github.com/kbinani/screenshot"
)
import "C"

//export GetFullScreen
func GetFullScreen(fp *C.char) {
filePath := C.GoString(fp)
bounds := screenshot.GetDisplayBounds(0)
img, err := screenshot.CaptureRect(bounds)
if err != nil {
fmt.Println(err)

return
}
file, err := os.Create(filePath)
if err != nil {
fmt.Println(err)
return
}
defer file.Close()
png.Encode(file, img)
}
func main() {
}
Loading