仅需一条命令

1
grep "Failed password for root" /var/log/secure | awk '{print $11}' | sort | uniq -c | sort -nr | more

结果类似下面这样:

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
4377 103.41.124.18
4368 103.41.124.65
3900 62.210.178.226
2214 103.41.124.33
409 62.210.142.105
404 115.231.222.45
152 122.225.97.91
95 122.225.109.205
81 109.195.69.233
42 74.52.105.154
21 87.106.184.62
21 87.106.1.211
21 82.165.154.23
21 69.64.64.62
21 67.226.156.239
21 61.40.192.52
21 60.213.190.98
21 27.251.179.130
21 222.77.190.33
21 211.172.219.251
21 210.249.105.10
15 220.194.46.36
12 203.184.128.106
1 60.190.71.52
1 193.104.41.58

这样我们就可以很清楚的了解有谁在尝试破解我们的密码了,之后做个相关安全策略就可以简单防治了

在Linux内源码编译安装的Git如果出现了 “Unable to find remote helper for ‘https’” 错误,则说明编译的时候没有发现系统有openssl开发包

解决办法就是在编译之前安装相关的开发包就可以了。

在CentOS系统中使用下面命令来安装

1
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel

在升级win8.1之后,重新安装的Git虽然可以正常使用
但遇到https时会报“Unable to find remote helper for ‘https’”的错误

网络搜索了许久未果,于是自己研究

  1. 检查安装的文件
    结果:所有文件均完整

  2. 检查文件的访问权限
    结果:所有文件当前用户均可访问

  3. 为调用的git等exe文件授予管理员运行权限
    结果:问题依旧存在

按理说,只要当前用户拥有文件的所有访问权限,就可以正常使用了。
并且,按这个错误来分析。应该是remote-https模块没有权限访问

挣扎了半天,尝试重装解决。

在重装的时候选择了 管理员权限运行
结果意外的发现重装后,https可以正常使用了。

至此问题解决。

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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/env python
"""
:license: MIT
Copyright (C) 2012 HustMoon
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
from __future__ import with_statement
import zlib, sys
def b128encode(buf, escape=False):
if not buf: return ''
buf = bytearray(buf)
res = bytearray((len(buf) * 8 + 6) / 7)
p, s, i = 0, 1, 0
for n in buf:
res[i] = ((p << (8 - s) | (n >> s)) &amp; 0x7F) | 0x80; i += 1
if s == 7:
res[i] = n | 0x80; i += 1
p, s = 0, 1
else:
p, s = n, (s + 1) % 8
if s != 1:
if s == 2 and p < 0x80:
i -= 1
else:
p = (p << (8 - s)) &amp; 0x7F
p = chr(p)
if escape:
p = p.encode('string-escape')
res[i:] = p
return str(res)
def dcode():
code = r'''def code(__=code):
(_______)=(globals)();del((_______)['code'])
if(((_______).get('__doc__'))is((None))):
(__)=(map)((ord),(__)[(339):]);(______)=[0]*(((((len)((__))+(1))*(7))/(8)));((___),(____),(_____))=((0),(0),(0))
for((__))in((__)):
if((__)<(128)):break
if((____)==(0)):((___),(____))=((__),(1))
else:
(______)[(_____)]=((((___)<<(____))|(((__)&amp;(127))>>((7)-(____))))&amp;(255));(_____)+=(1);((___),(____))=((__),(((____)+(1))%(8)))
if((__)<(128)):
if((____)!=(0)):
(__)=((((___)<<(____))|((__)>>((7)-(____))))&amp;(255))
(______)[(_____):]=[((__))]
elif((____)!=(0)):del((______)[(_____):])
exec((''.join((map)((chr),(______))).decode('zlib')))in((_______))
if(((_______).get('__doc__'))is((None))):(_______)['__doc__']=''
code()
'''
return ''.join([c.encode('string-escape') if ord(c) < 128 else c
for c in zlib.compress(code, 9)])
dcode = dcode()
def encode(infile, outfile):
with open(infile, 'rU') as fp:
code = fp.read().rstrip('n') + 'n'
code = b128encode(zlib.compress(code, 9), True)
code = r'''# -*- coding: latin-1 -*-
code = '%s'
exec(code.decode('zlib'))
''' % (dcode + code)
with open(outfile, 'wb') as fp:
fp.write(code)
def decode(infile, outfile):
with open(infile, 'rU') as fp:
code = fp.read().rstrip('n') + 'n'
code = code.replace("exec(code.decode('zlib'))", "exec(code.decode('zlib')"
".replace('exec','fp.write').replace('in((_______))',''))")
with open(outfile, 'wb') as fp:
eval(compile(code, 's', 'exec'), {'fp':fp})
def main():
try:
if sys.argv[1] == '-d':
func = decode
infile, outfile = sys.argv[2:4]
else:
func = encode
infile, outfile = sys.argv[1:3]
except ValueError:
print >>sys.stderr, 'Usage: zipcode.py [-d] infile.py outfile.py'
raise SystemExit(-1)
func(infile, outfile)
if __name__ == '__main__':
main()

不再需要导入atl.lib库了,直接包含以下头文件就可以了

1
2
3
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>

要使用 AtlAxAttachControl 等函数的话,则必须初始化ATL模块

1
2
CComModule _Module;
_pAtlModule = &amp;_Module;

我们这里使用源码编译安装,直接按顺序执行下列命令就可以成功(我都是假设已经有root权限的情况下,所以执行之前请确认自己已有root权限):

1
2
3
4
5
6
7
8
9
10
11
12
13
yum install -y mercurial gcc-c++ gcc
mkdir /usr/local
cd /usr/local
hg clone -r release https://go.googlecode.com/hg/ go
cd /usr/local/go/src
chmox +x all.bash
./all.bash
mkdir /root/go
export GOROOT=/usr/local/go
export GOPATH=/root/go
export GOBIN=/usr/local/go/bin
export GOOS=linux
export PATH=.:$PATH:/usr/local/go/bin

现在应该已经可以执行go命令测试了:

1
2
[root@root]# go version
go version go1.3.3 linux/amd64

如果想要每次进入bash时都拥有go环境,则需要新建一个文件:/etc/profile.d/go.sh 并写入以下内容

1
2
3
4
5
export GOROOT=/usr/local/go
export GOPATH=/root/go
export GOBIN=/usr/local/go/bin
export GOOS=linux
export PATH=.:$PATH:/usr/local/go/bin

现在随时都可以执行go命令了。

:)

今天给一台CentOS系统安装openssl-devel时,出现了如下信息:

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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
[root@centos]# yum install -y openssl-devel
Loaded plugins: fastestmirror, security
Repository updates is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* base: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.tuna.tsinghua.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package openssl-devel.x86_64 0:1.0.1e-16.el6_5.14 will be installed
--> Processing Dependency: krb5-devel for package: openssl-devel-1.0.1e-16.el6_5.14.x86_64
--> Running transaction check
---> Package krb5-devel.x86_64 0:1.10.3-15.el6_5.1 will be installed
--> Processing Dependency: libselinux-devel for package: krb5-devel-1.10.3-15.el6_5.1.x86_64
--> Processing Dependency: libcom_err-devel for package: krb5-devel-1.10.3-15.el6_5.1.x86_64
--> Processing Dependency: keyutils-libs-devel for package: krb5-devel-1.10.3-15.el6_5.1.x86_64
--> Running transaction check
---> Package keyutils-libs-devel.x86_64 0:1.4-4.el6 will be installed
---> Package libcom_err-devel.x86_64 0:1.41.12-18.el6 will be installed
---> Package libselinux-devel.x86_64 0:2.0.94-5.3.el6_4.1 will be installed
--> Processing Dependency: libselinux = 2.0.94-5.3.el6_4.1 for package: libselinux-devel-2.0.94-5.3.el6_4.1.x86_64
--> Processing Dependency: libsepol-devel >= 2.0.32-1 for package: libselinux-devel-2.0.94-5.3.el6_4.1.x86_64
--> Processing Dependency: pkgconfig(libsepol) for package: libselinux-devel-2.0.94-5.3.el6_4.1.x86_64
--> Running transaction check
---> Package libselinux.i686 0:2.0.94-5.3.el6_4.1 will be installed
--> Processing Dependency: libdl.so.2(GLIBC_2.1) for package: libselinux-2.0.94-5.3.el6_4.1.i686
--> Processing Dependency: libdl.so.2(GLIBC_2.0) for package: libselinux-2.0.94-5.3.el6_4.1.i686
--> Processing Dependency: libdl.so.2 for package: libselinux-2.0.94-5.3.el6_4.1.i686
--> Processing Dependency: libc.so.6(GLIBC_2.8) for package: libselinux-2.0.94-5.3.el6_4.1.i686
--> Processing Dependency: ld-linux.so.2(GLIBC_2.3) for package: libselinux-2.0.94-5.3.el6_4.1.i686
--> Processing Dependency: ld-linux.so.2 for package: libselinux-2.0.94-5.3.el6_4.1.i686
---> Package libsepol-devel.x86_64 0:2.0.41-4.el6 will be installed
--> Running transaction check
---> Package glibc.i686 0:2.12-1.132.el6_5.2 will be installed
--> Processing Dependency: libfreebl3.so(NSSRAWHASH_3.12.3) for package: glibc-2.12-1.132.el6_5.2.i686
--> Processing Dependency: libfreebl3.so for package: glibc-2.12-1.132.el6_5.2.i686
--> Running transaction check
---> Package nss-softokn-freebl.i686 0:3.14.3-10.el6_5 will be installed
--> Finished Dependency Resolution
Error: Multilib version problems found. This often means that the root
cause is something else and multilib version checking is just
pointing out that there is a problem. Eg.:
1\. You have an upgrade for libselinux which is missing some
dependency that another package requires. Yum is trying to
solve this by installing an older version of libselinux of the
different architecture. If you exclude the bad architecture
yum will tell you what the root cause is (which package
requires what). You can try redoing the upgrade with
--exclude libselinux.otherarch ... this should give you an error
message showing the root cause of the problem.
2\. You have multiple architectures of libselinux installed, but
yum can only see an upgrade for one of those arcitectures.
If you don't want/need both architectures anymore then you
can remove the one with the missing update and everything
will work.
3\. You have duplicate versions of libselinux installed already.
You can use "yum check" to get yum show these errors.
...you can also use --setopt=protected_multilib=false to remove
this checking, however this is almost never the correct thing to
do as something else is very likely to go wrong (often causing
much more problems).
Protected multilib versions: libselinux-2.0.94-5.3.el6_4.1.i686 != libselinux-2.0.94-5.3.0.1.el6.centos.plus.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

最后在一个日文的网站上找到了解决办法:

1
yum install --enablerepo=centosplus openssl-devel

参考:http://blog.urban-theory.net/2014/06/16/openssl-devel-install-fails-on-centos-with-docker

当内核加载失败时,使用以下命令查看出错记录,可以帮助找到问题所在:

1
dmesg | tail -n 30

1
2
3
4
5
6
7
8
9
10
yum install rpmdevtools yum-utils ncurses-devel make rpm-build rpm-devel
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.8.10.tar.gz
tar xvf linux-3.8.10.tar.gz
cd linux-3.8.10
make mrproper # 第一次可忽略
make menuconfig # 记得保存
make
make modules_install
make install
new-kernel-pkg --mkinitrd --depmod --install 3.8.10