Living a Simple Life is a Happy Life

有饭吃,自由自在,就非常开心

NiceHash被盗

| Comments

Nicehash 被盗 4700+币

比 bitfinex 要幸运一点,这次发现的比较早,但是按照现在的币价大涨来算,损失也超过了 6000w USD,上次 bitfinex 11w 币不过折合 7000w USD 而已。

https://www.reddit.com/r/NiceHash/comments/7i0s6o/official_press_release_statement_by_nicehash/

这个是 hacker 的转入地址:

https://btc.com/1EnJHhq8Jq8vDuZA5ahVh6H4t6jh1mB4rq

最早的一笔交易发生在 2017-12-06 13:17:12(UTC+8)

How to Penetrate GFW With ShadowSocks Docker Container on Centos7

| Comments

The quickest way to Penetrate GFW With ShadowSocks(Docker Container) On Centos7.

Install Docker CE

1
2
3
$ sudo yum install -y yum-utils   device-mapper-persistent-data  lvm2
$ sudo yum-config-manager    --add-repo     https://download.docker.com/linux/centos/docker-ce.repo
$ sudo yum install docker-ce

start docker

1
sudo systemctl start docker

pull shadowsocks container

1
sudo docker pull oddrationale/docker-shadowsocks

start shadowsocks service

1
sudo docker run -d -p 1984:1984 oddrationale/docker-shadowsocks -s 0.0.0.0 -p 1984 -k $SSPASSWORD -m aes-256-cfb

You can configure the service to run on a port of your choice. Just make sure the port number given to Docker is the same as the one given to shadowsocks. Also, it is highly recommended that you store the shadowsocks password in an environment variable as shown above. This way the password will not show in plain text when you run docker ps.

For more command line options, refer to the shadowsocks documentation

windows Client

Client is the machine you want to bypass the GFW.

Download the client package Shadowsocks-win-latest-release, extract it, and run.

You can check its “System Proxy” option, which is convenient for all browsers and terminal.

now enjoy it

Game Theory

| Comments

看网易公开课的博弈论,很有意思,记下笔记:

导论-五个入门结论

  1. don’t play a strictly dominated strategy

  2. rational choice in case lead to outcomes suck

  3. you can’t get what you want ,till you know what you want

  4. put yourself in others’ shoes and try to figure out what they will do

  5. most people are evil

How to Config Samba Config With No Password Share

| Comments

年老记忆力下降,做了N+1遍了,还是忘。

卸载干净

apt-get purge samba
rm -rf /etc/samba /etc/default/samba

重装

apt-get install samba

配置

vim /etc/samba/smb.conf


[share_name]
public = yes
browseable = yes
path = /home
guest ok = yes
read only = no
writeable = yes
create mask = 0644
directory mask = 2777

重启

systemctl restart smbd

排障

绝大多数的不能访问的错误都是由两个原因引起:

  • 权限问题;特别是你应该仔细检查最上层目录的权限和拥有者;大多数时候你用root创建的目录,但是访问共享的时候却用samba用户

  • 防火墙问题,特别是selinux,关闭它试试

Http Referer 的盗链与反盗链

| Comments

HTTP的图片防盗链技术基本上人民群众喜闻乐见了。 今天突然发现一种比较通用的隐藏referer来反盗链的hack手段,记录之。

简单来说,Referer是HTTP协议中的一个请求报头,用于告知服务器用户的来源页面。比如说你从Google搜索结果中点击进入了某个页面,那么该次HTTP请求中的Referer就是Google搜索结果页面的地址。

一般Referer主要用于统计,像CNZZ、百度统计等可以通过Referer统计访问流量的来源和搜索的关键词(包含在URL中)等等,方便站长们有针性对的进行推广和SEO什么的~

当然Referer另一个用处就是防盗链了,主要是图片和网盘服务器使用的较多。盗链的危害不言而喻,侵犯了版权不说,增加了服务器的负荷,却没有给真正的服务提供者带来实际利益(广告点击什么的)

另外要注意的是,Referer是由浏览器自动为我们加上的,以下情况是不带Referer的

  • 直接输入网址或通过浏览器书签访问

  • 使用JavaScript的Location.href或者是Location.replace()

  • HTTPS等加密协议

很多网站挟持脚本一般是注入https链接来隐藏referer,这样固然好用,但是一定要一个域名,有点不方便。前人实践发现只要在iframe里面的src属性填上 javascript: <html>....的内容就可以隐藏referer了。一试果然如此。

比如大家常见的微信公众号文章,如果引用过来,一般就是防盗链了,这个时候可以用下面的通用代码解决:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
   jQuery(function() {
       //遍历所有的img元素,凡是QQ和微信引用的统统放到iframe里面
       jQuery("div").find("img").each(function() {
           var img = jQuery(this);
           var img_src = img.attr("src");
           if (img_src != undefined && img_src != '') {
               img_src = decodeURI(img_src);
               img_src = img_src.split("?")[0];
               if (img_src.indexOf("qpic.cn") > 0 || img_src.indexOf("qlogo.cn") > 0 || img_src.indexOf("qq.com") > 0) {
                   var frameid = 'frameimg' + Math.random();
                   img.parent().append('<span id="' + frameid + '"></span>')
                   img.remove();
                   document.getElementById(frameid).innerHTML = ReferrerKiller.imageHtml(img_src);
               }
           }
       })
   })

这样看出来的效果就是原来引用微信的图片:

<img src="http://mmbiz.qpic.cn/mmbiz/cfxQzmUp8b0E12wMVv6SzROhSAgmxENxKPSQibVNhXAx8vr3BQW1lnlakR8wDVLc38QSZwnRfiaDtPZ0d3PhBMtQ/640?"/>

就会被替换到iframe里面,同时iframe的src属性包括了完整的html内容,这样浏览器请求图片的时候,就不会带referrer了,微信的盗链就被绕过。

不知道微信啥时候堵上这个洞呢?

Btc UAHF

| Comments

UTC时间 2017-08-01 18:12,UAHF第一个大于1MB的块被挖出,虽然现在算力占比很小,但值得关注,UAHF是否能存活下去,算力来决定吧。

Set Local Repo by Iso

| Comments

想要挂载一个iso安装镜像作为本地repo

mount iso

mkdir -p /mnt/cdrom
mount -t iso9660 -o loop /home/Centosxxxx.iso /mnt/cdrom

set local repo

vi /etc/yum.repos.d/local.repo

[localrepo]
name=Unixmen Repository
baseurl=file:///mnt/cdrom
gpgcheck=0
enabled=1

set up

yum clean all
yum repolist

Deploy Local Ntp Server on Centos7

| Comments

有时候需要内网环境搭建一个ntp服务器同步内网的几台机器。

四步走:

安装ntpd

yum -y install ntp ntpdate

修改/etc/ntpd.conf

# line 18: add the network range you allow to receive requests
restrict 10.0.0.0 mask 255.255.255.0 nomodify notrap

# local clock
server 127.127.1.0
fudge  127.127.1.0 stratum 10

重启

systemctl start ntpd
systemctl enable ntpd
firewall-cmd --add-service=ntp --permanent
firewall-cmd --reload

瞄一眼

watch ntpq -p

注意reach这个值,在启动ntp server服务后,这个值就从0开始不断增加,当增加到17的时候,从0到17是5次的变更,每一次是poll的值的秒数,是64秒*5=320秒的时间。

如果之后从ntp客户端同步ntp server还失败的话,用ntpdate –d来查询详细错误信息,再做判断。

How to Update to gcc4.9.x on Centos7

| Comments

现在很多软件包默认编译要求GLIBCXX >=3.4.20,碰到这种事redhat系又哭了,目前Centos7.x默认仓库里的gcc还是4.8.5的,所以需要一个办法升级gcc相关组件>=4.9.1。

CentOS下升级gcc版本有两个途径,一个是添加其他源进行自动升级,一个是手动编译升级,这里先顺便讲下自动升级的两个办法:

添加Fedora源

在 /etc/yum.repos.d 目录中添加文件 FedoraRepo.repo ,并输入以下内容:

[warning:fedora]
name=fedora
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-23&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=https://getfedora.org/static/34EC9CBA.txt

然后执行

yum update gcc gcc-c++

使用Devtoolset-4升级

yum install centos-release-scl
yum install devtoolset-4-gcc*
scl enable devtoolset-4 bash
which gcc
gcc --version