Mac Address Spoofing and Dynamic Hostname on Linux

Last Update: 2019-09-10


Functions: changing the mac address and hostname for each boot.

Tip: The example code is on Debian.

Mac Address Spoofing

Use macchanger to spoof manually

The macchanger (a.k.a., the GNU MAC Changer) provides a variety of features such as changing the address to match a certain vendor or completely randomizing it.

Install the package macchanger from the official repositories.

1
2
sudo apt update
sudo apt install macchanger -y

Display available network interfaces.

1
ip a

Change the mac address:

1
sudo macchanger -r your_interface_name

Read More

利用 GPG 签名验证文件的完整及可靠性

如果你想要同时验证下载文件的可靠性(拥有者)和完整性(内容),你需要依赖于加密签名。本教程中,将描述如何使用 GnuPG(GNU Privacy Guard)来检查文件的可靠性和完整性。

本例中将验证一个从 https://opensuse.org 上下载的磁盘镜像。这个网站中,发行商会提供他们的公钥,还有它用于密钥验证的指纹。

Public Key and Fingerprint

至于下载的文件,发行商提供它了相关的利用 GPG 签名的含有 sha256 校验值的文件。

Download Files

安装 GnuPG 并且生成一个键对

在 Debian、Ubuntu 和其他 Debian 衍生版上:

1
sudo apt install gpg

在 Fedora、CentOS 或者 RHEL 上:

1
sudo yum install gnupg

完成安装后,生成一个键对。

Gen Key

在生成键对期间,用户会被要求提供姓名和 email,还有保护私钥的密码。用户同样也可以选择键对何时过期(默认不会过期)。依赖于用户选择的 key 的大小(在 1024 和 4096 位之间),key 生成会花上几分钟或者更多,同时它要求收集来自你桌面活动的大量的随机数据。(比如键盘输入、鼠标移动、磁盘访问等等,所以这个时候随便动动鼠标键盘什么的)。

一旦 key 生成完毕后,公钥和私钥会存储在 ~/.gnupg 目录。

Created

Read More

Centos 7 下安装 Shadowsocks Python 版

本文以 Vultr 购买的 Centos 7 主机为例,详细介绍了安装 Shadowsocks Python 版的方法。建议以密钥的方式绑定主机并以此登录,注意保护好自己的密钥。

准备

首先,更新系统:

yum update

为了防止被人暴力扫描破解登录密码,我们先对 Vultr 自动生成的密码进行重置:

passwd root

这里我个人使用了 256 位随机密码,包含特殊字符。

另外也可以安装 fail2ban 来禁止掉反复尝试登录的ip地址:

yum install fail2ban

启用 fail2ban:

systemctl enable fail2ban

Read More

Line and Circular Interpolation on XY Plane

Tips: This is my homework of “Computer Control System” course, so mistakes do happen.

This article will discuss an interpolation algorithms for line and circular. And it provides an implement of C language.

Interpolation Algorithms

Many numerical control machines are powered by stepping motors. When a pulse is sent to a stepping motor, the stepping motor alters its position by a unit step. Two motors can be used to control the XY movements of an arm or tool over a working plane.

If the pulse are generated by a device which can remember or generate a specified train of pulses, repetitive operations such as grinding, painting, or cutting can be performed hunderds of times with virtually no variation. A microcomputer is an obvious choice to gernerate and remember the pulse.

Since stepper motors can move only in discrete steps, we must approximate the actual curve by a series of small XY motions. Many algorithms rely upon parametric functions such as sine and cosine to perform the necessary calculations. Parametric functions, however, typically require a high degree of numeric precision. Calculating sine and cosine values with a microcomputer can be too time-consuming to be useful in a realtime application.

The following two algorithms require no parametric functions. This makes them ideally suited to the
computation and memory capacities of microcomputers. Since these algorithms do not require a large amount of complex mathematical calculation, they are fast enough to be used in real-time applications.

Read More

Kali Linux 以 root 用户运行 Chrome 和 VLC

需要了解的信息

  1. 有些应用之所以在 Kali Linux 下无法启动,是因为它们不允许以 root 用户的身份运行,通常,我们可以直接修改相应的二进制文件,将 getuid 改为 getppid,来达到我们的目的。不过这样破坏了安全性,也会因为软件的反复更新,而需要每次做重复的操作。

  2. 我们可以使用 gksu -u <username> <bin> 的方式来在终端以其他用户的身份启动应用。

  3. usr/share/applications 路径下陈列着应用菜单里相应的 .desktop 文件。其中 Exec 参数定义了执行的命令。

综述,我们可以创建一个普通的用户,并修改应用菜单执行命令,来达到在 root 桌面环境下方便地以其他用户身份运行应用的目的。

例:使用 Chrome

添加一个名为 normaluser 的用户:

1
useradd -m normaluser

此时,便可以用此用户运行 Chrome:

1
gksu -u normaluser google-chrome-stable

此外,编辑 /usr/share/applications 下的 google-chrome.desktopExec 参数改为:

1
gksu -u normaluser /usr/bin/google-chrome-stable %U

这样,我们便可以通过桌面图标启动 Chrome 了。

Read More

Mastodon