A Woodbridge information technology worker pleaded guilty Thursday to assisting a sophisticated computer-hacking scheme in which he and others took over YouTube channels from unsuspecting users to collect tens of thousands of dollars in ad revenue.

John T. Hoang Jr., 34, told a federal judge in Alexandria that another man, Matthew Buchanan, gave him most of the information but that he wrote the software that helped bring in the cash. That software identified more than 200,000 Google account names linked to popular YouTube video channels that users had not monetized by setting up ads.

Buchanan and Hoang then hacked in to those accounts, took them over and set them up with ads.

The ingenuity and scope of their exploits, which ran from June 2012 through September 2013, was enough to draw the attention of federal investigators.

According to Hoang’s plea, they took control of more than 400 Google accounts and made nearly $56,000.

Thirty-five of the YouTube accounts they took over, linked to Google accounts, were generating more than 6 million page views each month, according to the plea.

Hoang pleaded guilty to a charge of unauthorized access of a protected computer, which carries a possible maximum sentence of five years in prison when he is sentenced April 11. In court Thursday, he suggested that although he lent his computer expertise, Buchanan mostly drove the scheme.

“Matthew Buchanan gave me most of the information I needed to write the code, but he didn’t know how to actually write the code, I guess,” Hoang said.

Buchanan, 28, also pleaded guilty this month to unauthorized access of a protected computer, admitting that in addition to running the YouTube scheme, he exploited a vulnerability to access the e-mail accounts of AOL employees, including that of the chief executive. He is scheduled to be sentenced March 28.

Stephen F. Brennwald, the attorney for Hoang, said in court that his client had never met Buchanan, although the two corresponded through online chats.

Their backgrounds — both professional and personal — are somewhat different.

Buchanan, of Germantown, told a federal judge that he holds an associate degree in general studies from Montgomery College and that although he was once a student at Walt Whitman High School in Bethesda, he ultimately earned a GED. He said that he had not worked in the past three years and that the only job he’d had was at a grocery store when he was 16.

Hoang told a judge that he spent three semesters at George Mason University studying accounting and ended up working in a variety of tech-based jobs. He said he had worked as an IT consultant, freelance Web site designer and, most recently, a search-engine evaluator for a company called Leapforce.

According to Hoang’s and Buchanan’s pleas, the two men exploited Google’s process for resetting passwords in order to get into the accounts of unwitting users, which they then used to take over their YouTube channels. Users can sign into their YouTube accounts through Google because Google owns YouTube.

The process was not always simple. According to the pleas, the men used a flaw in the password-reset procedure to learn the e-mail addresses of various Google users, then used password-cracking software to get into their accounts. In some cases, they took advantage of Google users who entered what they thought were defunct secondary e-mail addresses, such as dog@yahoo.com, by controlling those e-mail addresses and having temporary passwords sent there, according to the plea.

The aim was not to incite simple cyber mayhem but to make money.

According to the plea, Buchanan and Hoang seemed to marvel at the scheme, which Buchanan called “treasure huntin’ ” in online chats.

In one chat in November 2012, Hoang wrote: “like had we not started [this] project i’d of probably had to get a job,” according to the plea.

Hoang’s attorney declined to comment after the hearing.

Get updates on your area delivered via e-mail