JueLuo's Blog


  • Home

  • Categories

  • Archives

  • Tags

  • Search

Python 判断当前运行的文件所在的位置

Posted on 2019-01-10 | In Python
1
os.path.split(os.path.abspath(__file__))[0]

原理

os.path.abspath(__file__) 获取当前运行的文件的绝对路径 os.path.split(path)[0] 分割路径,元组的第一部分为路径,第二部分为文件名

Read more »

Python 使用 sqlite3 模块创建的数据库默认位置

Posted on 2019-01-10 | In Python

等同于该方式获取的位置:os.path.split(os.path.abspath(__file__))[0]

Read more »

解决 Markdown 中表格内出现竖线“|”时无法正常渲染的问题

Posted on 2018-12-12 | In Markdown
在 Markdown 中,表格内出现竖线“ ”会被认为是表格的一部分
Read more »

搭建树莓派+PanDownload(aria2)远程下载器

Posted on 2018-10-04 | In 树莓派 , Linux

在下载百度云盘的内容时,偶然发现 PanDownload 拥有一个远程下载的功能,于是萌生了利用闲置树莓派作为下载机长时间开机下载的想法。

Read more »

Debian7 Asf

Posted on 2018-10-04

本文介绍如何在 Linux 上搭建 ArchiSteamFarm 来作为一个 Steam 机器人

解决网络问题

请自行寻找可用的的代理!

这里参考 https://steamcn.com/t339641-1-1

  • 查看自己操作系统版本 uname -a ,得到返回结果如下:
    1
      Linux VM-0-7-debian 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u2 (2017-06-26) x86_64 GNU/Linux
    

    可知操作系统为64位,选择对应平台的程序使用

  • 下载完毕使用 rz 命令上传至服务器(百度云使用命令行下载不太方便)

  • 解压
    1
      unzip ascf_v2.0.0_Linux_x64.zip
    
  • 给予运行权限
    1
      chmod +x ascf
    
  • 使用 screen 开启一个新的 session 防止在 SSH 断开后程序停止
    1
      screen -S AnotherSteamCommunityFix
    
  • 使用 ./ascf 运行,此时已可以安全断开会话

安装运行 ASF 所需的 .NET SDK

  • 参考微软官方的 Install .NET Core SDK on Linux Debian 8 x64 ,经测试在Debian7上可用

安装 ASF

  • 下载并解压运行于 Linux 的 ASF
    1
    2
      wget https://github.com/JustArchiNET/ArchiSteamFarm/releases/download/3.4.0.1/ASF-linux-x64.zip
      unzip ASF-linux-x64.zip
    
  • 使用 rz 上传在 ASF Web Config 下载的配置文件并放入 ASF 下的 config 目录内

  • 给予运行权限
    1
      chmod +x 
    
  • 创建新的 screen 以防中断SSH时结束 ASF
    1
      chmod +x ArchiSteamFarm 
    
  • 运行 ASF
    1
      ./ArchiSteamFarm
    
Read more »

在树莓派上安装 Nginx + PHP

Posted on 2018-06-10 | In 树莓派

网上找到的大部分教程均已过时,自己总结了当前(2018年6月)在树莓派上可行的 Nginx + PHP 的安装方法

Read more »

修改树莓派键盘布局

Posted on 2018-06-06 | In 树莓派

树莓派默认使用的是英国键盘布局,在直接用键盘连接至树莓派时,可能会出现部分符号屏幕显示与键盘显示不一致的情况。

Read more »

DVWA + LAMP 安装完成后的最后调整

Posted on 2018-04-03 | In 网络安全

使用 LAMP 的默认配置搭建 DVWA 后可能仍然会在 setup.php 页面上见到数行红字,这里简单描述下解决方法

PHP function allow_url_include: Disabled

如果不修复此项,在使用 File Inclusion 模块时会出现 The PHP function allow_url_include is not enabled. 的错误提示

修复方式:

使用 vim /usr/local/php/etc/php.ini 命令打开配置文件 (别的运行环境请使用 find / -name php.ini 命令找到配置文件)

在 vim 内摁下 Shift + : 输入 /allow_url_include 回车搜索

将 allow_url_include = Off 的参数改为 on

service httpd restart 重启 Apache

reCAPTCHA key: Missing

谷歌验证码的功能不可用,考虑到我国🤔国情,修复了也没什么用

修复方式:

前往 https://www.google.com/recaptcha/admin#list 根据页面提示申请一个 key,并将申请获得的 key 填入 DVWA 的配置文件 config.inc.php 内

Read more »

CentOS 7 + DVWA 安装搭建过程

Posted on 2018-04-03 | In 网络安全 , Linux

下载

DVWA 的官方网站:http://www.dvwa.co.uk/

DVWA 的 Github 页面:https://github.com/ethicalhack3r/DVWA

可以先从 Windows 上下载后导入 CentOS7

也可以使用命令 wget https://github.com/ethicalhack3r/DVWA/archive/master.zip 来下载 DVWA

如有提示 bash: apt: command not found... 的,请使用 yum install wget 命令安装 wget 工具( debian 系的 Linux 请使用 apt install wget 来安装)

下载完成后,在 Win 下先行解压,或是使用 unzip DVWA-master.zip 来获得 DVWA 文件夹,稍后即用

运行环境

这里直接使用 LAMP 来达到 Linux + Apache + MySQL + PHP 的环境要求 运行 wget -c http://soft.vpser.net/lnmp/lnmp1.4.tar.gz && tar zxf lnmp1.4.tar.gz && cd lnmp1.4 && ./install.sh lamp 一路回车选择默认项,稍等片刻,即可完成安装

也可以参考 LAMP的官方页面 来进行详细的自定义安装

当然手动配置一个符合条件的环境也是完全可以的!

安装 DVWA

将之前解压出的 DVWA 文件夹放入 /home/wwwroot/default/ ( LAMP 默认的网站目录)内

此时访问 http://10.29.219.79/DVWA (我的 CentOS7 主机地址,请访问自己对应主机的IP,下同),会出现如下错误提示

1
DVWA System error - config file not found. Copy config/config.inc.php.dist to config/config.inc.php and configure to your environment.

根据提示,我们进入 /home/wwwroot/default/DVWA/config,使用 cp config.inc.php.dist config.inc.php 将配置文件复制一份,然后输入 vim config.inc.php 开始编辑配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php

# If you are having problems connecting to the MySQL database and all of the variables below are correct
# try changing the 'db_server' variable from localhost to 127.0.0.1. Fixes a problem due to sockets.
#   Thanks to @digininja for the fix.

# Database management system to use
$DBMS = 'MySQL';
#$DBMS = 'PGSQL'; // Currently disabled

# Database variables
#   WARNING: The database specified under db_database WILL BE ENTIRELY DELETED during setup.
#   Please use a database dedicated to DVWA.
#
# If you are using MariaDB then you cannot use root, you must use create a dedicated DVWA user.
#   See README.md for more information on this.
$_DVWA = array();
$_DVWA[ 'db_server' ]   = '127.0.0.1';
$_DVWA[ 'db_database' ] = 'dvwa';
$_DVWA[ 'db_user' ]     = 'root';
$_DVWA[ 'db_password' ] = 'p@ssw0rd';

# Only used with PostgreSQL/PGSQL database selection.
$_DVWA[ 'db_port '] = '5432';

# ReCAPTCHA settings
#   Used for the 'Insecure CAPTCHA' module
#   You'll need to generate your own keys at: https://www.google.com/recaptcha/admin/create
$_DVWA[ 'recaptcha_public_key' ]  = '';
$_DVWA[ 'recaptcha_private_key' ] = '';

# Default security level
#   Default value for the secuirty level with each session.
#   The default is 'impossible'. You may wish to set this to either 'low', 'medium', 'high' or impossible'.
$_DVWA[ 'default_security_level' ] = 'impossible';

# Default PHPIDS status
#   PHPIDS status with each session.
#   The default is 'disabled'. You can set this to be either 'enabled' or 'disabled'.
$_DVWA[ 'default_phpids_level' ] = 'disabled';

# Verbose PHPIDS messages
#   Enabling this will show why the WAF blocked the request on the blocked request.
#   The default is 'disabled'. You can set this to be either 'true' or 'false'.
$_DVWA[ 'default_phpids_verbose' ] = 'false';

?>

其中,我们只需要将 $_DVWA[ 'db_password' ] = 'p@ssw0rd'; 这行的密码修改为我们的 MySQL 使用的默认密码 root 即可(如果在安装 LAMP 时选择了其他数据库密码,这里请填写相应的密码)

完成安装

完成上述步骤后,访问 http://10.29.219.79/DVWA ,将会被重定向至 http://10.29.219.79/DVWA/setup.php,单击页面底部的 Create / Reset Database 按钮,即可跳转至 DVWA 的登陆页面,开始使用吧~

额外补充

  • 由于目标系统为 Linux 记得在浏览器地址栏输入地址时区分大小写
  • DVWA 的默认登陆帐号是 admin 密码是 password
  • 在 setup.php 页面上我们仍然会看到几行红字,修复方式见后续文章
Read more »

Metasploit 没有自动连接 postgresql 数据库的解决方法

Posted on 2017-10-10 | In 网络安全

启动 metasploit 后,发现没有自动连接 postgresql 数据库

  • 连接的命令为 db_connect 用户名:密码@ip/数据库名

  • 连接默认数据库的命令为 db_connect msf3:[email protected]/msf3

如果还是无法连接,则尝试以下步骤

  1. 使用 service postgresql status 查看并确保 postgresql 服务已经启动,然后使用 su postgres 命令切换到 postgre 账户

  2. 使用 createuser msf3 –P 命令创建一个 postgresql 数据库账户
    命令中的msf3是要创建的用户名,-P 表示立即给角色指定一个口令
    接下来根据提示输入两次,此次使用 toor 作为密码

  3. 使用 createdb --owner=msf3 msf3 创建数据库
    owner参数表示数据库的所有者,此次指定给刚刚创建的msf3,最后一个“msf3”表示数据库的名称

  4. 使用 exit 命令退出当前用户,回到 root 用户手动连接的步骤
    再次尝试 db_connect msf3:msf@localhost/msf3

Read more »
1 … 5 6 7
JueLuo

JueLuo

The better we get at getting better, the faster we will get better.

65 posts
21 categories
86 tags
GitHub Weibo Steam
© 2015 - 2024 JueLuo
Powered by Jekyll
Theme - NexT.Pisces