2016年5月22日 星期日

Error: failed to fetch from registry: debug

http://stackoverflow.com/questions/12913141/message-failed-to-fetch-from-registry-while-trying-to-install-any-module

Error: failed to fetch from registry: debug


sudo apt-get purge nodejs npm
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs

sudo: unable to resolve host

https://blog.longwin.com.tw/2008/11/linux-sudo-unable-to-resolve-host-2008/



/etc/hosts 原始內容

##################################################################################################################################################################

127.0.0.1       localhost
# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
##################################################################################################################################################################
127.0.0.1       localhost dev
# 或 改成下面這兩行
#127.0.0.1       localhost
#127.0.0.1       dev
# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

check show used port linux


sudo lsof -i
sudo netstat -lptu
sudo netstat -tulpn



ps -fp 1289
sudo netstat -plnt | grep ':80'

2016年4月17日 星期日

ufw, firewall ubuntu, uncomplicated firewall

sudo ufw disable
sudo ufw enable
sudo ufw status verbose

Even if error occurs, you can check that ufw is running.
sudo ufw status verbose

sudo service ufw status

2016年4月12日 星期二

mongo error Failed global initialization: BadValue Invalid or no user locale set. Please ensure LANG and/or LC_* environment variables are set correctly.

 Failed global initialization: BadValue Invalid or no user locale set. Please ensure LANG and/or LC_* environment variables are set correctly.


solution:
export LC_ALL=C

mongo --version


from:
http://askubuntu.com/questions/536875/error-in-installing-mongo-in-virtual-machine/537324

MEAN install ubuntu

2016/4/13

from:
https://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/

mongodb:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927

echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list

sudo apt-get update


sudo apt-get install -y mongodb-org



2016年3月28日 星期一

user folder directory permission


Given full permission of folder htdocs/ to Ben:
chown ben:ben -R htdocs/ 



wordpress files structure , understand

from:https://codex.wordpress.org/WordPress_Files


WordPress Root

index.php
Core WordPress index. This is the file that produces the blog output.
license.txt
The WordPress GPL license file.
my-hacks.php
Contains supplemental routines that are processed before output is produced. This is not included in the default install, but is referenced by the administration page if available.
readme.html
Pre-install information about WordPress.
wp-atom.php
Produces Atom syndication output.
wp-blog-header.php
Decides what to display based on the parameters that are passed to the blog. Included from any page that wants to display WordPress content.
wp-cron.php
wp-comments-post.php
Receives posted comments and adds them to the database.
wp-commentsrss2.php
Produces RSS2 syndication output of post comments.
wp-config-sample.php
A sample configuration file for connecting WordPress to your MySQL database.
wp-config.php
The actual configuration file used to connect WordPress to your MySQL database. This is not included in the default install, but must exist for successful operation of WordPress. You may need to edit this file to modify certain configuration settings.
wp-feed.php
Decides the type of feed to produce based on a request and re-routes to the correct feed-producing file.
wp-links-opml.php
Produces OPML output of Links that were added to the blog via the WordPress admin menu.
wp-login.php
The WordPress login page for registered users.
wp-mail.php
Used for obtaining blog posts that were submitted via email. The URL of this file is usually added to a cron job so that it is regularly retrieved, so that new email posts are accepted.
wp-pass.php
Accepts the password needed to view password-protected posts, then redirects back to the protected post.
wp-rdf.php
Produces RDF syndication output.
wp-register.php
Allows new users to register usernames in WordPress via an online form.
wp-rss.php
Produces RSS syndication output.
wp-rss2.php
Produces RSS2 syndication output.
wp-settings.php
Performs various pre-execution routines, including checking for correct installation, including auxiliary functions, applying user plugins, initializing execution timers, etc.
wp-trackback.php
Handles incoming trackback requests.
wp.php
A very simple template for displaying blog posts. Does not include a lot of the fancy but fragile features of index.php.
xmlrpc.php
Handles incoming xmlrpc commands. Among other things, this allows posting without using the built-in web-based administrative interface.

wp-admin

wp-admin/admin.php
The core of the admin files. Connects to the database, integrates the dynamic menu data, displays non-core console (dashboard) pages, etc.
wp-admin/admin-db.php
wp-admin/admin-footer.php
Contains the bottom of the admin console. Included from each of the console pages.
wp-admin/admin-functions.php
Contains various functions used by the admin console.
wp-admin/admin-header.php
Contains the top half of the admin console. Includes menu-header.php for menu logic.
wp-admin/bookmarklet.php
The pop-up page that is displayed when using the bookmarklet. Uses the default edit-form.php page for post input.
wp-admin/categories.php
Admin console page for category management. See: Manage - Categories
wp-admin/cat-js.php
wp-admin/edit.php
Admin console for post management. See: Manage - Posts
wp-admin/edit-comments.php
Admin console page for comment management. See: Manage - Comments
wp-admin/edit-form-advanced.php
Admin console page for the advanced post editing form. Included from post.php. See: Write - Write Post - Advanced
wp-admin/edit-form.php
Admin console page for the simple post editing form. Included from post.php. See: Write - Write Post
wp-admin/edit-form-comment.php
Edits a specific post comment.
wp-admin/edit-form-ajax-cat.php
wp-admin/edit-link-form.php
wp-admin/edit-page-form.php
Admin console page for editing pages. Included from post.php and page-new.php. See: Write - Write Page
wp-admin/edit-pages.php
Admin console for page management. See: Manage - Pages
wp-admin/execute-pings.php
wp-admin/import.php
wp-admin/index.php
The administrative default page. Redirects to an appropriate page based on user access.
wp-admin/inline-uploading.php
wp-admin/install-helper.php
A set of functions for database maintenance, including the popular-in-plugins maybe_create_table() and maybe_add_column().
wp-admin/install.php
Installs WordPress.
wp-admin/link-add.php
Admin console page to add links. See: Links - Add Link
wp-admin/link-categories.php
Admin console page for link category management. See: Links - Link Categories
wp-admin/link-import.php
Admin console page used to import links. See: Links - Import Links
wp-admin/link-manager.php
Admin console page for link management. See: Links - Manage Links
wp-admin/link-parse-opml.php
Contains functions used to parse an OPML file when importing links.
wp-admin/list-manipulation.js
wp-admin/list-manipulation.php
wp-admin/menu-header.php
The file used to display the menu in the admin interface.
wp-admin/menu.php
The default admin menu structure.
wp-admin/moderation.php
Contains functions related to comments moderation.
wp-admin/options.php
Admin console file that can be used to change every settings in one update.
wp-admin/options-discussion.php
Admin console page to manage options regarding comments and trackbacks. See: Options - Discussion
wp-admin/options-general.php
Admin console page to manage options regarding basic configuartion settings. See: Options - General
wp-admin/options-head.php
wp-admin/options-misc.php
Admin console page to manage options regarding file uploads, link tracking and support for custom "hacks". See: Options - Miscellaneous
wp-admin/options-permalink.php
Admin console page to manage options regarding permalinks. See: Options - Permalinks
wp-admin/options-reading.php
Admin console page to manage options regarding how the information from your site is sent to a reader's web browser or other application. See: Options - Reading
wp-admin/options-writing.php
Admin console page to manage options regarding the interface with which you write new posts. See: Options - Writing
wp-admin/page-new.php
Admin console page to create a new page.
wp-admin/plugin-editor.php
Admin console page to edit a plugin file.
wp-admin/plugins.php
Admin console page to manage plugins.
wp-admin/post.php
Admin console page to create a new post.
wp-admin/profile-update.php
wp-admin/profile.php
Admin console page to manage your profile.
wp-admin/setup-config.php
Admin console page to create the wp-config.php file for the first time.
wp-admin/sidebar.php
wp-admin/templates.php
Admin console page to edit any server-writeable file.
wp-admin/theme-editor.php
Admin console page to edit any file within a specific theme.
wp-admin/themes.php
Admin console page to manage themes.
wp-admin/update-links.php
wp-admin/upgrade-functions.php
Contains functions related to version upgrading.
wp-admin/upgrade-schema.php
Contains default MySQL tables structure and default options, used when upgrading.
wp-admin/upgrade.php
Admin console page to upgrade froma lower version to a higher one.
wp-admin/user-edit.php
Admin console page to edit a user.
wp-admin/users.php
Admin console page to manage users.
wp-admin/wp-admin.css
The default stylesheet for the administrative console.
wp-admin/xfn.js

wp-admin/images

This directory holds images associated and used by WordPress in the Administration Panels.
wp-admin/images/box-bg.gif
wp-admin/images/boxbg-left.gif
wp-admin/images/boxbg-right.gif
wp-admin/images/box-butt.gif
wp-admin/images/box-butt-left.gif
wp-admin/images/box-butt-right.gif
wp-admin/images/box-head.gif
wp-admin/images/box-head-left.gif
wp-admin/images/browse-happy.gif
wp-admin/images/fade-butt.png
wp-admin/images/notice.gif
wp-admin/images/toggle.gif
wp-admin/images/wordpres-logo.png

wp-admin/import

wp-admin/import/b2.php
Used for importing posts from b2. See: Importing Content - b2
wp-admin/import/blogger.php
Used for importing posts from Blogger. See: Importing Content - Blogger
wp-admin/import/dotclear.php
wp-admin/import/greymatter.php
Used for importing posts from Greymatter. See: Importing Content - Greymatter
wp-admin/import/livejournal.php
Used for importing posts from LiveJournal. See: Importing Content - LiveJournal
wp-admin/import/mt.php
Used for importing posts from Movable Type. See: Importing Content - Movable Type
wp-admin/import/rss.php
Used to import posts via RSS. See: Importing Content - RSS
wp-admin/import/textpattern.php
Used for importing posts from TextPattern. See: Importing Content - Textpattern

wp-content

This directory is typically not upgraded.
The /wp-content/ directory is for user-supplied content. WordPress upgrades are supposed to specifically avoid doing anything to any of the contents of this directory, unless the user wants the latest version of the default WordPress Themes.
WordPress Themes and WordPress Plugins are stored in this directory.

wp-content/plugins

All WordPress plugins are placed in this directory. The default plugin shipped with WordPress is an example plugin mostly for plugin developers, the Hello Dolly plugin, which displays random lines of the song "Hello Dolly." Current versions also inlude the Akismetcomment spam fighting WordPress Plugin as an option.
wp-content/plugins/hello.php
wp-content/plugins/akismet.php

wp-content/themes

All WordPress Theme data is placed within this directory in its own folder such as example.com/wp-content/themes/themedirectory/.

wp-content/themes/themedir

All files associated with a WordPress Theme are stored in their own directory under the wp-content/themes/themedir directory. As an example of the Theme files, the typical files included in the WordPress Default Theme under /wp-content/themes/default/ would be:
wp-content/themes/themedir/comments.php
Used to manage how the comments are displayed.
wp-content/themes/themedir/footer.php
Used to manage the footer of the pages.
wp-content/themes/themedir/header.php
Used to manage the header of every page.
wp-content/themes/themedir/index.php
Used to manage how the posts are displayed in your homepage.
wp-content/themes/themedir/search.php
Used to display a search form to search for entries.
wp-content/themes/themedir/sidebar.php
Used to manage the sidebar.
wp-content/themes/themedir/style.css
The main CSS file of WordPress.

wp-content/themes/themedir/images

Some WordPress Themes store images in a subdirectory under their Theme folder. For example, images used by the default theme are in wp-content/themes/default/images/.

wp-includes

wp-includes/cache.php
wp-includes/capabilities.php
wp-includes/class-IXR.php
The Incutio XML-RPC Library. Contains XML RPC support functions. Supplied by http://scripts.incutio.com/xmlrpc/
wp-includes/classes.php
Contains basic classes including the core post-fetching mechanism, WP_Query, and the rewrite manger, WP_Rewrite.
wp-includes/class-pop3.php
Contains a support class for accessing POP mailboxes. Used by wp-mail.php
wp-includes/class-snoopy.php
Snoopy is a PHP class that simulates a web browser. It automates the task of retrieving web page content and posting forms, for example.
wp-includes/comment-functions.php
wp-includes/default-filters.php
wp-includes/feed-functions.php
wp-includes/functions-compat.php
Contains support functions that are present in newer PHP versions that are used only when running on older PHP versions.
wp-includes/functions-formatting.php
Contains support functions for cleaning XHTML and formatting text correctly in certain character sets.
wp-includes/functions-post.php
Contains support functions for managing posts in the database, querying user capabilities, fetching and writing comments, etc.
wp-includes/functions.php
Contains numerous vital support functions. Largest file in WordPress -- almost double the next largest file.
wp-includes/gettext.php
Part of the PHP-gettext GPL translation library.
wp-includes/kses.php
Contains functions that are used to render and filter HTML in posts or comments.
wp-includes/links.php
Contains functions that are used to manage and use the Links feature of WordPress.
wp-includes/locale.php
Contains functions to replace default weekdays and months values.
wp-includes/pluggable-functions.php
wp-includes/registration-functions.php
wp-includes/rss-functions.php
wp-includes/streams.php
Contains a class to wrap file streams, string streams.
wp-includes/template-functions-author.php
Contains theme functions related to the author of a post or a comment.
wp-includes/template-functions-category.php
Contains theme functions related to categories.
wp-includes/template-functions-comment.php
Contains theme functions related to comments.
wp-includes/template-functions-general.php
Contains general theme functions.
wp-includes/template-functions-links.php
Contains theme functions related to links
wp-includes/template-functions-post.php
Contains theme functions related to posts.
wp-includes/template-functions.php
Contains all the "template-" files above.
wp-includes/template-loader.php
wp-includes/vars.php
Used to set miscellaneous variables.
wp-includes/version.php
Used to set the currently used WordPress version.
wp-includes/wp-db.php
Contains functions used to connect to the MySQL database.
wp-includes/wp-l10n.php
Contains functions used in multi-language support.

wp-includes/images

wp-includes/images/smilies

This is the directory that holds the smilies (emoticons) used in WordPress if the option is turned on. See Using Smilies for the full list.

wp-includes/js

wp-includes/js/quicktags.js
Javascript file that contains functions to manage the tags toolbox when editing posts or pages.

wp-includes/js/tinymce

This directory includes the files that run the Rich Text Editor in the Write Post panel.

wp-includes/languages

kali wordlist generate with couch

https://pentestlab.wordpress.com/2012/07/12/creating-wordlists-with-crunch/



simple wordlist


crunch 4 8

Where the first number (4) is the shortest word length and the second (8) is the longest word length.



crunch 6 8 1234567890 -o /root/numericwordlist.lst
the target always used number passwords between 6 and 8 characters

 crunch 10 10 -t @@@@@@0728 -o /root/birthdaywordlist.lst
If we knew that the target's birthday was July 28 and they likely used that date (people often use their birthdates in their passwords to make it easier to remember) at the end of a ten character password? We could generate all the possibilities of ten-character passwords that end with 0728 and send the output to a file in the root user's directory named birthdaywordlist.lst, by typing:





Websploit

http://www.ehacking.net/2013/05/kali-linux-tutorial-websploit-framework.html

web attack


wsf > show modules
wsf > use web/dir_scanner
wsf:Dir_Scanner > show options
set TARGET http://ehacking.net
wsf:Dir_Scanner > run

2016年2月18日 星期四

aws, elastic , can not connect to express port


the default aws port are 80,443 and 222, and the default port of express is 3000.


sudo iptables -A INPUT -p tcp --dport 3000 -j ACCEPT

2016年2月17日 星期三

ubuntu ufw, firewall

sudo apt-get install ufw
sudo ufw status verbose
sudo ufw status
sudo ufw disable
sudo ufw enable
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
Disable and enable ufw to apply the changes:
sudo ufw disable
sudo ufw enable



2016年2月15日 星期一

kill application , linux

kill process
ps -aux | grep NAME
pkill -f NAME

Kill by pid
kill -9 <pid>


清理所有temp
cd /tmp/
rm -rf *


find process by port
ps -fp 1289
lsof -t -i:3000

2016年1月23日 星期六

tcp vs udp



from: http://www.cyberciti.biz/faq/key-differences-between-tcp-and-udp-protocols/


Difference between TCP and UDP

TCPUDP
Reliability: TCP is connection-oriented protocol. When a file or message send it will get delivered unless connections fails. If connection lost, the server will request the lost part. There is no corruption while transferring a message.Reliability: UDP is connectionless protocol. When you a send a data or message, you don't know if it'll get there, it could get lost on the way. There may be corruption while transferring a message.
Ordered: If you send two messages along a connection, one after the other, you know the first message will get there first. You don't have to worry about data arriving in the wrong order.Ordered: If you send two messages out, you don't know what order they'll arrive in i.e. no ordered
Heavyweight: - when the low level parts of the TCP "stream" arrive in the wrong order, resend requests have to be sent, and all the out of sequence parts have to be put back together, so requires a bit of work to piece together.Lightweight: No ordering of messages, no tracking connections, etc. It's just fire and forget! This means it's a lot quicker, and the network card / OS have to do very little work to translate the data back from the packets.
Streaming: Data is read as a "stream," with nothing distinguishing where one packet ends and another begins. There may be multiple packets per read call.Datagrams: Packets are sent individually and are guaranteed to be whole if they arrive. One packet per one read call.
Examples: World Wide Web (Apache TCP port 80), e-mail (SMTP TCP port 25 Postfix MTA), File Transfer Protocol (FTP port 21) and Secure Shell (OpenSSH port 22) etc.Examples: Domain Name System (DNS UDP port 53), streaming media applications such as IPTV or movies, Voice over IP (VoIP), Trivial File Transfer Protocol (TFTP) and online multiplayer games etc

Error CheckingTCP does error checkingUDP does error checking, but no recovery options.
Header SizeTCP header size is 20 bytesUDP Header size is 8 bytes.
Use by other protocolsHTTP, HTTPs, FTP, SMTP, TelnetDNS, DHCP, TFTP, SNMP, RIP, VOIP.