HTML:Iframe-inf wordpress Infection

February 12th, 2010

 

Here is an article that really helped me getting my server back up and running.

HTML:Iframe-inf wordpress Infection

If your blog has been infected by the HTML:Iframe-inf  infection according to avast here are two scripts that can help you.

First What is the HTML:Iframe infection? – Its just a line of text that is inserted at the end of every index.php and/or index.htm in your website. Nothing to freak out about but you want to fix it. And Its probably due to wordpress not being secure.

Anyways, here is what you do : This is something you run on the commmand line – See the video below for an idea.

You will need to find infected files first.

find / -type f | xargs grep -l ‘<iframe’  2>/dev/null or you could print out a list of files possibly comprimised. by typing find / -type f | xargs grep -l ‘<iframe’  2>/dev/null >infectedFileslist.txt

The first step is figuring out what is going on with your virus infection.

If you know the time frame of when the virus ran then you could narrow the list of infected files even more by tweaking the find command.

Lets say you know it infected your website about 5 days ago.

Then you would modify the find command to search all files modified less than 10 days ago.

find / -type f -mtime -10 | xargs grep -l ‘<iframe’  2>/dev/null >infectedFileslist.txt

More info on the find command here

http://content.hccfl.edu/pollock/Unix/FindCmd.htm my short version find . -mtime +5 -mtime -10 # find files modifed between 5 and 10 days ago Ok so now you have a list of infected files … This is VERY HELPFUL as you are halfway there to cleaning up your server.

Remove infected text

find / -type f -mtime -10 | xargs grep -l ‘<iframe’| xargs perl -pi -e ’s/^.*\<iframe.*$/ /g’ Here is an explanation of what the script does line by line so you can adjust per your situation. find / -type f -mtime -10 - looks all files that were modified in the last 10 days ( you adjust as needed) xargs grep -l ‘<iframe’ - of that list of files modified recently look for a line that says <iframe xargs perl -pi -e ’s/^.*\<iframe.*$/ /g’ - search and replace that line with a blank space Understanding this last line - perl -pi -e is important — http://www.linux.org/lessons/short/perlpie/perl_pie.html You want to be sure that you know whats going on there because this is where the search and the replace happens - Check out this article — http://www.linux.org/lessons/short/perlpie/perl_pie.html You can modify the script line by line to

Here is a video explaining this:

 

 

admin server issues , , ,

Tuning / Optimizing my.cnf file for MySQL

February 12th, 2010

This one really helped me.

Had to do some fine tuning of MySQL 4.1.9 and here is what my.cnf file looks like for a 2GHz machine with 1GB of memory.

[mysqld]
socket=/path/to/mysql.sock
datadir=/var/lib/mysql
skip-locking
skip-innodb
# MySQL 4.x has query caching available.
# Enable it for vast improvement and it may be all you need to tweak.
query_cache_type=1
query_cache_limit=1M
query_cache_size=32M
# max_connections=500
# Reduced to 200 as memory will not be enough for 500 connections.
# memory=key_buffer+(sort_buffer_size+read_buffer_size)*max_connections
# which is now: 64 + (1 + 1) * 200 = 464 MB
# max_connections = approx. MaxClients setting in httpd.conf file
# Default set to 100.
#max_connections=200
#interactive_timeout=180
interactive_timeout=100
#wait_timeout=180
#wait_timeout=100
# Reduced wait_timeout to prevent idle clients holding connections.
#wait_timeout=30
wait_timeout=15
connect_timeout=10
# max_connect_errors is set to 10 by default
#max_connect_errors=10
#table_cache=256
#table_cache=1024
# Checked opened tables and adjusted accordingly after running for a while.
table_cache=512
#tmp_table_size=32M by default
#thread_cache=128
# Reduced it to 32 to prevent memory hogging. Also, see notes below.
thread_cache=32
# key_buffer=258M
# Reduced it by checking current size of *.MYI files, see notes below.
key_buffer=128M
# Commented out the buffer sizes and keeping the default.
# sort_buffer_size=2M by default.
#sort_buffer_size=1M
# read_buffer_size=128K by default.
#read_buffer_size=1M
# 1Mb of read_rnd_buffer_size for 1GB RAM -- see notes below.
# read_rnd_buffer_size=256K by default.
#read_rnd_buffer_size=1M
# myisam_sort_buffer_size used for ALTER, OPTIMIZE, REPAIR TABLE commands.
# myisam_sort_buffer_size=8M by default.
#myisam_sort_buffer_size=64M
# thread_concurrency = 2 * (no. of CPU)
thread_concurrency=2
# log slow queries is a must. Many queries that take more than 2 seconds.
# If so, then your tables need enhancement.
log_slow_queries=/var/log/mysqld.slow.log
long_query_time=2

[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
open_files_limit=8192

[mysqldump]
quick
max_allowed_packet=16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

[myisamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

[mysqlhotcopy]
interactive-timeout 

[client]
socket=/path/to/mysql.sock

Below are notes on some of the important variables, I took down while tuning the config file.

  1. query_cache_size:
    • MySQL 4 provides one feature that can prove very handy - a query cache. In a situation where the database has to repeatedly run the same queries on the same data set, returning the same results each time, MySQL can cache the result set, avoiding the overhead of running through the data over and over and is extremely helpful on busy servers.
  2. key_buffer_size:
    • The value of key_buffer_size is the size of the buffer used with indexes. The larger the buffer, the faster the SQL command will finish and a result will be returned. The rule-of-thumb is to set the key_buffer_size to at least a quarter, but no more than half, of the total amount of memory on the server. Ideally, it will be large enough to contain all the indexes (the total size of all .MYI files on the server).
    • A simple way to check the actual performance of the buffer is to examine four additional variables: key_read_requests, key_reads, key_write_requests, and key_writes.
    • If you divide the value of key_read by the value of key_reads_requests, the result should be less than 0.01. Also, if you divide the value of key_write by the value of key_writes_requests, the result should be less than 1.
  3. table_cache:
    • The default is 64. Each time MySQL accesses a table, it places it in the cache. If the system accesses many tables, it is faster to have these in the cache. MySQL, being multi-threaded, may be running many queries on the table at one time, and each of these will open a table. Examine the value of open_tables at peak times. If you find it stays at the same value as your table_cache value, and then the number of opened_tables starts rapidly increasing, you should increase the table_cache if you have enough memory.
  4. sort_buffer:
    • The sort_buffer is very useful for speeding up myisamchk operations (which is why it is set much higher for that purpose in the default configuration files), but it can also be useful everyday when performing large numbers of sorts.
  5. read_rnd_buffer_size:
    • The read_rnd_buffer_size is used after a sort, when reading rows in sorted order. If you use many queries with ORDER BY, upping this can improve performance. Remember that, unlike key_buffer_size and table_cache, this buffer is allocated for each thread. This variable was renamed from record_rnd_buffer in MySQL 4.0.3. It defaults to the same size as the read_buffer_size. A rule-of-thumb is to allocate 1KB for each 1MB of memory on the server, for example 1MB on a machine with 1GB memory.
  6. thread_cache:
    • If you have a busy server that’s getting a lot of quick connections, set your thread cache high enough that the Threads_created value in SHOW STATUS stops increasing. This should take some of the load off of the CPU.
  7. tmp_table_size:
    • “Created_tmp_disk_tables” are the number of implicit temporary tables on disk created while executing statements and “created_tmp_tables” are memory-based. Obviously it is bad if you have to go to disk instead of memory all the time.

admin mysql , ,

How to become wealthy. Lesson 9

November 10th, 2009

“A PRETTY AFTER-DINNER SPEECH FOR A
BILLION DOLLARS

“When, on the evening of December 12, 1900, some eighty of the nation’s financial nobility gathered in the banquet hail of the University Club on Fifth Avenue to do honor to a young man from out of the West, not half a dozen of the guests realized they were to witness the most significant episode in American industrial history.
“J. Edward Simmons and Charles Stewart Smith, their hearts full of gratitude for the lavish hospitality bestowed on them by Charles M. Schwab during a recent visit to Pittsburgh, had arranged the dinner to introduce the thirty-eight-year-old steel man to eastern banking society. But they didn’t expect him to stampede the convention. They warned him, in fact, that the bosoms within New York’s stuffed shirts would not be responsive to oratory, and that, if he didn’t want to bore the Stilhnans and Harrimans and Vanderbilts, he had better limit himself to fifteen or twenty minutes of polite vaporings and let it go at that.
“Even John Pierpont Morgan, sitting on the right hand of Schwab as became his imperial dignity, intended to grace the banquet table with his presence only briefly. And so far as the press and public were concerned, the whole affair was of so little moment that no mention of it found its way into print the next day.
“So the two hosts and their distinguished guests ate their way through the usual seven or eight courses. There was little conversation and what there was of it was restrained. Few of the bankers and brokers had met Schwab, whose career had flowered along the banks of the Monongahela, and none knew him well. But before the evening was over, they—and with them Money Master Morgan were to be swept off their feet, and a billion dollar baby, the United States Steel Corporation, was to be conceived.
“It is perhaps unfortunate, for the sake of history, that no record of Charlie Schwab’s speech at the dinner ever was made. He repeated some parts of it at a later date during a similar meeting of Chicago bankers. And still later, when the Government brought suit to dissolve the Steel Trust, he gave his own version, from the witness stand, of the remarks that stimulated Morgan into a frenzy of financial activity.
“It is probable, however, that it was a ‘homely’ speech, somewhat ungrammatical (for the niceties of language never bothered Schwab), full of epigram and threaded with wit. But aside from that it had a galvanic force and effect upon the five billions of estimated capital that was represented by the diners. After it was over and the gathering was still under its spell, although Schwab had talked for ninety minutes, Morgan led the orator to a recessed window where, dangling their legs from the high, uncomfortable seat, they talked for an hour more.
“The magic of the Schwab personality had been turned on, full force, but what was more important and lasting was the full- fledged, clear-cut program he laid down for the aggrandizement of Steel. Many other men had tried to interest Morgan in slapping together a steel trust after the pattern of the biscuit, wire and hoop, sugar, rubber, whisky, oil or chewing gum combinations. John W. Gates, the gambler, had urged it, but Morgan distrusted him. The Moore boys, Bill and Jim, Chicago stock jobbers who had glued together a match trust and a cracker corporation, had urged it and failed. Elbert H. Gary, the sanctimonious country lawyer, wanted to foster it, but he wasn’t big enough to be impressive. Until Schwab’s eloquence took J. P. Morgan to the heights from which he could visualize the solid results of the most daring financial undertaking ever conceived, the project was regarded as a delirious dream of easy-money crackpots.
“The financial magnetism that began, a generation ago, to attract thousands of small and sometimes inefficiently managed companies into large and competition-crushing combinations, had become operative in the steel world through the devices of that jovial business pirate, John W. Gates. Gates already had formed the American Steel and Wire Company out of a chain of small concerns, and together with Morgan had created the Federal Steel Company. The National Tube and American Bridge companies were two more Morgan concerns, and the Moore Brothers had forsaken the match and cookie business to form the ‘American’ group— Tin Plate, Steel Hoop, Sheet Steel—and the National Steel Company.
“But by the side of Andrew Carnegie’s gigantic vertical trust, a trust owned and operated by fifty-three partners, those other combinations were picayune. They might combine to their heart’s content but the whole lot of them couldn’t make a dent in the Carnegie organization, and Morgan knew it.
“The eccentric old Scot knew it, too. From the magnificent heights of Skibo Castle he had viewed, first with amusement and then with resentment, the attempts of Morgan’s smaller companies to cut into his business. When the attempts became too bold, Carnegie’s temper was translated into anger and retaliation. He decided to duplicate every mill owned by his rivals. Hitherto, he hadn’t been interested in wire, pipe, hoops, or sheet. Instead, he was content to sell such companies the raw steel and let them work it into whatever shape they wanted. Now, with Schwab as his chief and able lieutenant, he planned to drive his enemies to the wall.
“So it was that in the speech of Charles M. Schwab, Morgan saw the answer to his problem of combination. A trust without Carnegie-giant of them all—would be no trust at all, a plum pudding, as one writer said, without the plums.
“Schwab’s speech on the night of December 12, 1900, undoubtedly carried the inference, though not the pledge, that the vast Carnegie enterprise could be brought under the Morgan tent. He talked of the world future for steel, of reorganization for efficiency, of specialization, of the scrapping of unsuccessful mills and concentration of effort on the flourishing properties, of economies in the ore traffic, of economies in overhead and administrative departments, of capturing foreign markets.
“More than that, he told the buccaneers among them wherein lay the errors of their customary piracy. Their purposes, he inferred, bad been to create monopolies, raise prices, and pay themselves fat dividends out of privilege. Schwab condemned the system in his heartiest manner. The shortsightedness of such a policy, he told his hearers, lay in the fact that it restricted the market in an era when everything cried for expansion. By cheapening the cost of steel, he argued, an ever-expanding market would be created; more uses for steel would be devised, and a goodly portion of the world trade could be captured. Actually, though he did not know it, Schwab was an apostle of modern mass production.
“So the dinner at the University Club came to an end. Morgan went home, to think about Schwab’s rosy predictions. Schwab went back to Pittsburgh to run the steel business for ‘Wee Andra Carnegie,’ while Gary and the rest went back to their stock tickers, to fiddle around in anticipation of the next move.
“It was not long coming. It took Morgan about one week to digest the feast of reason Schwab had placed before him. When he had assured himself that no financial indigestion was to result, he sent for Schwab-and found that young man rather coy. Mr. Carnegie, Schwab indicated, might not like it if he found his trusted company president had been flirting with the Emperor of Wall Street, the Street upon which Carnegie was resolved never to tread. Then it was suggested by John W. Gates the go-between, that if Schwab ‘happened’ to be in the Bellevue Hotel in Philadelphia, J. P. Morgan might also ‘happen’ to be there. When Schwab arrived, however, Morgan was inconveniently ill at his New York home, and so, on the elder man’s pressing invitation, Schwab went to New York and presented himself at the door of the financier’s library.
“Now certain economic historians have professed the belief that from the beginning to the end of the drama, the stage was set by Andrew Carnegie—that the dinner to Schwab, the famous speech, the Sunday night conference between Schwab and the Money King, were events arranged by the canny Scot. The truth is exactly the opposite. When Schwab was called in to consummate the deal, he didn’t even know whether ‘the little boss,’ as Andrew was called, would so much as listen to an offer to sell, particularly to a group of men whom Andrew regarded as being endowed with something less than holiness. But Schwab did take into the conference with him, in his own handwriting, six sheets of copperplate figures, representing to his mind the physical worth and the potential earning capacity of every steel company he regarded as an essential star in the new metal firmament.
“Four men pondered over these figures all night. The chief, of course, was Morgan, steadfast in his belief in the Divine Right of Money. With him was his aristocratic partner, Robert Bacon, a scholar and a gentleman. The third was John W. Gates whom Morgan scorned as a gambler and used as a tool. The fourth was Schwab, who knew more about the processes of making and selling steel than any whole group of men then living. Throughout that conference, the Pittsburgher’s figures were never questioned. If he said a company was worth so much, then it was worth that much and no more. He was insistent, too, upon including in the combination only those concerns he nominated. He had conceived a corporation in which there would be no duplication, not even to satisfy the greed of friends who wanted to unload their companies upon the broad Morgan shoulders. Thus he left out, by design, a number of the larger concerns upon which the Walruses and Carpenters of Wall Street had cast hungry eyes.
“When dawn came, Morgan rose and straightened his back. Only one question remained.
“Do you think you can persuade Andrew Carnegie to sell?’ he asked.
“I can try,’ said Schwab.
“If you can get him to sell, I will undertake the matter,’ said Morgan.
“So far so good. But would Carnegie sell? How much would he demand? (Schwab thought about $320,000,000). What would he take payment in? Common or preferred stocks? Bonds? Cash? Nobody could raise a third of a billion dollars in cash.
“There was a golf game in January on the frost-cracking heath of the St. Andrews links in Westchester, with Andrew bundled up in sweaters against the cold, and Charlie talking volubly, as usual, to keep his spirits up. But no word of business was mentioned until the pair sat down in the cozy warmth of the Carnegie cottage hard by. Then, with the same persuasiveness that had hypnotized eighty millionaires at the University Club, Schwab poured out the glittering promises of retirement in comfort, of untold millions to satisfy the old man’s social caprices. Carnegie capitulated, wrote a figure on a slip of paper, handed it to Schwab and said, ‘all right, that’s what we’ll sell for.’
“The figure was approximately $400,000,000, and was reached by taking the $320,000,000 mentioned by Schwab as a basic figure, and adding to it $80,000,000 to represent the increased capital value over the previous two years.
“Later, on the deck of a trans-Atlantic liner, the Scotsman said ruefully to Morgan, ‘I wish I had asked you for $100,000,000 more.’
“If you had asked for it, you’d have gotten it,’ Morgan told him cheerfully.
* * * * * * *
“There was an uproar, of course. A British correspondent cabled that the foreign steel world was ‘appalled’ by the gigantic combination. President Hadley, of Yale, declared that unless trusts were regulated the country might expect ‘an emperor in Washington within the next twenty-five years.’ But that able stock manipulator, Keene, went at his work of shoving the new stock at the public so vigorously that all the excess water—estimated by some at nearly $600,000,000—was absorbed in a twinkling. So Carnegie had his millions, and the Morgan syndicate had $62,000,000 for all its ‘trouble,’ and all the ‘boys,’ from Gates to Gary, had their millions.
* * * * * * *
“The thirty-eight-year-old Schwab had his reward. He was made president of the new corporation and remained in control until 1930.”
The dramatic story of “Big Business” which you have just finished, was included in this book, because it is a perfect illustration of the method by which DESIRE CAN BE TRANSMUTED INTO ITS PHYSICAL EQUIVALENT!
I imagine some readers will question the statement that a mere, intangible DESIRE can be converted into its physical equivalent. Doubtless some will say, “You cannot convert NOTHING into SOMETHING!” The answer is in the story of United States Steel.
That giant organization was created in the mind of one man. The plan by which the organization was provided with the steel mills that gave it financial stability was created in the mind of the same man. His FAITH, his DESIRE, his IMAGINATION, his PERSISTENCE were the real ingredients that went into United States Steel. The steel mills and mechanical equipment acquired by the corporation, AFTER IT HAD BEEN BROUGHT INTO LEGAL EXISTENCE, were incidental, but careful analysis will disclose the fact that the appraised value of the properties acquired by the corporation increased in value by an estimated SIX HUNDRED MILLION DOLLARS, by the mere transaction which consolidated them under one management.
In other words, Charles M. Schwab’s IDEA, plus the FAITH with which he conveyed it to the minds of J. P. Morgan and the others, was marketed for a profit of approximately $600,000,000. Not an insignificant sum for a single IDEA!
What happened to some of the men who took their share of the millions of dollars of profit made by this transaction, is a matter with which we are not now concerned. The important feature of the astounding achievement is that it serves as unquestionable evidence of the soundness of the philosophy described in this book, because this philosophy was the warp and the woof of the entire transaction. Moreover, the practicability of the philosophy has been established by the fact that the United States Steel Corporation prospered, and became one of the richest and most powerful corporations in America, employing thousands of people, developing new uses for steel, and opening new markets; thus proving that the $600,000,000 in profit which the Schwab IDEA produced was earned.

admin become wealthy, self improvement